O'Reilly logo
  • Longxiang Lyu thinks this is interesting:

10-6. Addition:

From

Cover of Python Crash Course

Note

def add(): num1 = raw_input('num1: ') num2 = raw_input('num2: ') try: n1 = float(num1) n2 = float(num2) except ValueError: print('*input is not number!*') else: print(str(n1) + ' + ' + str(n2) + ' = ' + str(n1 + n2))