## Text menu in Python def print_menu(): ## Your menu design here print 30 * "-" , "MENU" , 30 * "-" print "1. Menu login 1" print "2. Menu create an account 2" print "3. Menu list all accounts 3" print "4. Quit" print 67 * "-" loop!=4 while loop: ## While loop which will keep going until loop = False print_menu() ## Displays menu choice = input("Enter your choice [1-4]: ") if choice==1:"Menu login 1" count = 0 while True: def User(): login = raw_input("Enter login name: ") passw = raw_input("Enter password: ") # check if user exists and login matches password if login in users and users[login] == passw: print "\nLogin successful!\n" else: print "\nUser doesn't exist or wrong password!\n" if choice == 3: print("Too many attempts.") exit() for val in "string": if val == "i": break print(val) print("The end") if choice==2: print " Menu create an account 2" def main(): register() def register(): username = input("Please input your desired username ") password = input("Please input your desired password ") if not username or not password: print "Enter a valid username and password..." users = c.get_all_users() userList = users['list_users_response']['list_users_result']['users'] if username in userList: print "username already exist" else: # I just want to create if fields are not empty and if username dont exist c.create_user(username) file = open("credential.txt","a") file.write(username) file.write(" ") file.write(password) file.close() login() if choice==3: def login(): check = open("credential.txt","r") username = input("Please enter your username") password = input("Please enter your password") def thank_you(): print("Thank you for signing up at our website!.") elif choice == "q": exit()
[split] Function not working as intended
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Why this reverse lookup function not working | Emekadavid | 4 | 3,320 |
May-31-2020, 05:54 AM Last Post: Emekadavid |
|
[split] problem with function return value | ops | 1 | 4,483 |
Apr-13-2020, 01:48 PM Last Post: buran |
|
GUI and function not working together | albry | 2 | 3,364 |
Jan-15-2019, 07:32 AM Last Post: albry |
|
Simple IF statement not working as intended | gortexxx | 2 | 3,568 |
May-17-2018, 07:54 PM Last Post: gortexxx |
|
For and If Loop not working as intended | Jaykin | 1 | 3,114 |
Apr-29-2018, 01:14 PM Last Post: j.crater |
|
Function not working as intended I think? | TimeForged | 2 | 3,715 |
Mar-11-2018, 09:05 AM Last Post: buran |
Users browsing this thread: 1 Guest(s)