By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,835 Members | 1,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,835 IT Pros & Developers. It's quick & easy.

I want to run the entire program n times if it is a sameuser else need to exit

P: 2
I will take care thanks
Sep 11 '13 #1
Share this Question
Share on Google+
2 Replies

P: 2
i have trouble how to loop back to the top from the first incase it has same user else need to exit

Works fine until while sameuser == 'Yes'
But not sure how to get back to the top of the program if it is a YES
Please help
Sep 11 '13 #2

Expert 100+
P: 626
A while loop solves the problem
Expand|Select|Wrap|Line Numbers
  1. def print_user(user):
  2.     """ put code you want to execute here
  3.     """
  4.     print user
  6. orig_user = raw_input("Enter user name ")
  7. user = orig_user
  8. while user == orig_user:
  9.     print_user(user)
  10.     user = raw_input("Enter user name ") 
Sep 12 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.