1def calculate():
2 operation = input('''
3Please type in the math operation you would like to complete:
4+ for addition
5- for subtraction
6* for multiplication
7/ for division
8''')
9
10 number_1 = int(input('Please enter the first number: '))
11 number_2 = int(input('Please enter the second number: '))
12
13 if operation == '+':
14 print('{} + {} = '.format(number_1, number_2))
15 print(number_1 + number_2)
16
17 elif operation == '-':
18 print('{} - {} = '.format(number_1, number_2))
19 print(number_1 - number_2)
20
21 elif operation == '*':
22 print('{} * {} = '.format(number_1, number_2))
23 print(number_1 * number_2)
24
25 elif operation == '/':
26 print('{} / {} = '.format(number_1, number_2))
27 print(number_1 / number_2)
28
29 else:
30 print('You have not typed a valid operator, please run the program again.')
31
32 # Add again() function to calculate() function
33 again()
34
35def again():
36 calc_again = input('''
37Do you want to calculate again?
38Please type Y for YES or N for NO.
39''')
40
41 if calc_again.upper() == 'Y':
42 calculate()
43 elif calc_again.upper() == 'N':
44 print('See you later.')
45 else:
46 again()
47
48calculate()