[Tutor] help with code
Joel Goldstick
joel.goldstick at gmail.com
Sun Mar 11 07:16:11 EDT 2018
On Sat, Mar 10, 2018 at 11:20 PM, Leslie SimondeMontfort via Tutor <
tutor at python.org> wrote:
> Hi, I wondered if there is someone that can help me with this code. Thank
> you, Leslie
>
> ## 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()
> Sent from Mail for Windows 10
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
A quick look shows you are using print statements and print functions. So,
are you using python 3 or python 2? What exactly are you asking about?
--
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
More information about the Tutor
mailing list