File: class/Extras/Other/PriorClasses/nasa-ksc-aug15/interact.py

while True:
    answer = input('enter age:')
    if answer == 'stop': break
    try:
        print(float(answer) ** 2)
    except:
        print('Bad!')
print('bye')



"""
while True:
    answer = input('enter age:')
    if answer == 'stop':
       break 
    if not answer.isdigit():
        print('Bad!')
    else:
        print(int(answer) ** 2)
print('bye')
"""



[Home page] Books Code Blog Python Author Train Find ©M.Lutz