db={} def newuser(): prompt='login desired:' while True: username=input(prompt) if username in db: prompt='name taken,try another:' continue else: break password=input('please enter password:') db[username]=password def olduser(): username=input('please enter username:') password=input('please enter password:') psw=db.get(username) if password==psw: print ('Welcome back %s' % username) else: print ('login incorrect!') def showmenu(): prompt=''' (N)ew User Login (O)ld User Login (Q)uit Please enter your choice ''' done=False while not done: chosen=False while not chosen: try: choice=input(prompt).strip()[0].lower() except (EOFError,KeyboardInterrupt): choice='q' print ('\nYou picked:[%s]' %choice) if choice not in 'noq': print ('Invaild option, try again ') else: chosen='True' if choice=='q': done=True if choice=='n': newuser() if choice=='o': olduser() if __name__=='__main__': showmenu()