Hi I want to loop my program so that as soon as it hits Exceptions it restarts from the beginning !
>>> while True:
... try:
... x = int(raw_input("Please enter a number: "))
... break
... except ValueError:
... print "Oops! That was no valid number. Try again..."
How can I do this
You want to remove the
breakin yourtrystatement. It’s telling python to exit the while loop.