how to repeat if statement in python

Solutions on MaxInterview for how to repeat if statement in python by the best coders in the world

showing results for - "how to repeat if statement in python"
Rudy
08 Mar 2016
1def main():
2    while True:
3        again = raw_input("Would you like to play again? Enter y/n: ")
4
5        if again == "n":
6            print ("Thanks for Playing!")
7            return
8        elif again == "y":
9            print ("Lets play again..")
10        else:
11            print ("You should enter either \"y\" or \"n\".")
12
13if __name__ == "__main__":
14    main()