Python 2.7 for loop and not printing the right time -


okay writing simple login system, here code

import time counter in range(5):   username=str(raw_input("please enter username"))   password=str(raw_input("please enter password"))   if username =="bros10":      print "",username,"entered"      time.sleep(4)      print "you got username right"      if password =="brosbros10":         print "you got password right"         print "welcome system"         break  else:     print "try again" 

and happens when run print bit print "",username,"entered" after have entered password appreciated

move this:

print "",username,"entered" 

to before this:

password=str(raw_input("please enter password")) 

now program ask username, repeat username entered (and tell user got right if entered bros10), ask password, sleep 4 seconds.

alternatively, can place password= line right before one

if password =="brosbros10": 

if want ask password after waiting 4 seconds , repeating user input.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -