| Store | Cart

Re: [Tutor] help with code

From: Abdur-Rahmaan Janhangeer <arj....@gmail.com>
Sun, 11 Mar 2018 19:41:35 +0400
 print 30 * "-" , "MENU" , 30 * "-"

# just tested in py3 you can do
# 'MENU'.center(67, '-')

On Sun, Mar 11, 2018 at 8:20 AM, Leslie SimondeMontfort via Tutor <
tut...@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  -  Tut...@python.org> To unsubscribe or change subscription options:> https://mail.python.org/mailman/listinfo/tutor>



-- 
Abdur-Rahmaan Janhangeer
https://github.com/abdur-rahmaanj
Mauritius
_______________________________________________
Tutor maillist  -  Tut...@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Recent Messages in this Thread
Leslie SimondeMontfort via Tutor Mar 11, 2018 04:20 am
Joel Goldstick Mar 11, 2018 11:16 am
Cameron Simpson Mar 11, 2018 11:39 am
Alan Gauld via Tutor Mar 11, 2018 11:41 am
Bob Gailer Mar 11, 2018 03:17 pm
Abdur-Rahmaan Janhangeer Mar 11, 2018 03:41 pm
Messages in this thread