If you give anything but ['y', 'Y', 'yes', 'Yes', 'YES']
or ['No' , 'no' , 'NO' ,'n' , 'N']
, your program will finish and not execute any of the statements in their respective if
-clauses.
The reload()
function will not do what you expect. It's used to reload a module and should be used inside the interpreter. It also requires a previously imported module
as it's argument, calling it without will raise a TypeError
.
So in order to actually ask the questions again, you'll need a loop. For example:
while True:
name = raw_input('Enter your name: ')
age = raw_input('Enter your age: ')
qualifications = raw_input('Enter your Qualification(s): ')
print "Hello. Your name is {}. Your age is {}. Your qualifications are: {}".format(name, age, qualifications)
quit = raw_input("Is the above data correct [yY]? ").lower() # notice the lower()
if quit in ("y", "yes"):
break
else:
# If the input was anything but y, yes or any variation of those.
# for example no, foo, bar, asdf..
print "Rewrite the form below"
If you now input anything else than a y, Y
or any variation of yes
, the program will ask the questions again.