Hello everyone I just started python last night and I was fallowing this wonderful tutorial:
I am going to use this thread to ask for questions and get help for when I run into road blocks. So… here goes nothing!
- Is there a way to limit the amount of characters a user is supposed to input using a line like:
input = raw_input("Enter 5 to 20 characters: ")
- Is there a way to make it so the * symbol appears when typing, like a password?
- When using a line such as:
phonenumber = input("Enter your phone number: ")
Can you make it so ONLY numbers will appear when you press them? If you enter in letters, it will give you an error after you press enter.
This is my progress so far, I have just been experimenting with things I’ve learned from the tutorial. I just kinda compiled them into a simple script. This is the menu part of it, I will now add a dictionary with accounts and passwords.
print "Login script test." print print print def bye(): print "Bye!" input = "q" def confirm(): yes = raw_input("Enter y to continue: ") print "----------" if yes == "y": menu() else: confirm() def menu(): print print "---Menu---" print "c = to create an account." print "l = to login to an account." print "q = to quit." print input = "x" menu() while input != "q": input = raw_input("Enter new command: ") print print print if input == "c": print "This creates a new account..." confirm() elif input == "l": print "This will login to an account." confirm() elif input == "q": bye() else: print "Command not recognized, please enter a new one." confirm()