File: class/Extras/Other/PriorClasses/scotts-sep12/interact.py

"""
while True:
    inp = raw_input('Age=>')
    if inp == 'stop':
        break
    elif not inp.isdigit():
        print 'Bad!' * 8
    else:
        print float(inp) ** 2
print 'bye'
"""


while True:
    inp = raw_input('Age=>')
    if inp == 'stop': break
    try:
        print float(inp) ** 2
    except:
        print 'Bad!' * 8
print 'bye'





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