mihshyahoocom

mihshyahoocom

Mar 10th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. ## Text menu in Python
  2.  
  3. def print_menu(): ## Your menu design here
  4. print 30 * "-" , "MENU" , 30 * "-"
  5. print "1. Menu login 1"
  6. print "2. Menu create an account 2"
  7. print "3. Menu list all accounts 3"
  8. print "4. Quit"
  9. print 67 * "-"
  10.  
  11. loop!=4
  12.  
  13. while loop: ## While loop which will keep going until loop = False
  14. print_menu() ## Displays menu
  15. choice = input("Enter your choice [1-4]: ")
  16.  
  17. if choice==1:"Menu login 1"
  18. count = 0
  19. while True:
  20. def User():
  21. login = raw_input("Enter login name: ")
  22. passw = raw_input("Enter password: ")
  23.  
  24. # check if user exists and login matches password
  25. if login in users and users[login] == passw:
  26. print "\nLogin successful!\n"
  27. else:
  28. print "\nUser doesn't exist or wrong password!\n"
  29. if choice == 3:
  30. print("Too many attempts.")
  31. exit()
  32.  
  33.  
  34. for val in "string":
  35. if val == "i":
  36. break
  37. print(val)
  38.  
  39. print("The end")
  40.  
  41. if choice==2:
  42. print " Menu create an account 2"
  43.  
  44.  
  45. def main():
  46. register()
  47.  
  48. def register():
  49. username = input("Please input your desired username ")
  50. password = input("Please input your desired password ")
  51. if not username or not password:
  52. print "Enter a valid username and password..."
  53. users = c.get_all_users()
  54. userList = users['list_users_response']['list_users_result']['users']
  55. if username in userList:
  56. print "username already exist"
  57. else:
  58. # I just want to create if fields are not empty and if username dont exist
  59. c.create_user(username)
  60. file = open("credential.txt","a")
  61. file.write(username)
  62. file.write(" ")
  63. file.write(password)
  64. file.close()
  65. login()
  66.  
  67. if choice==3:
  68.  
  69. def login():
  70. check = open("credential.txt","r")
  71. username = input("Please enter your username")
  72. password = input("Please enter your password")
  73.  
  74. def thank_you():
  75. print("Thank you for signing up at our website!.")
  76.  
  77. elif choice == "q":
  78. exit()
Add Comment
Please, Sign In to add comment