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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kishoreraj
    New Member
    • Sep 2013
    • 2

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

    I will take care thanks
    Last edited by Rabbit; Sep 11 '13, 09:26 PM. Reason: Please use code tags when posting code or formatted data.
  • kishoreraj
    New Member
    • Sep 2013
    • 2

    #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

    Comment

    • dwblas
      Recognized Expert Contributor
      • May 2008
      • 626

      #3
      A while loop solves the problem
      Code:
      def print_user(user):
          """ put code you want to execute here
          """
          print user
      
      orig_user = raw_input("Enter user name ")
      user = orig_user
      while user == orig_user:
          print_user(user)
          user = raw_input("Enter user name ")

      Comment

      Working...