#### Question

# My python code isn't working as expected

What did I do wrong?

```
def calculate():
operation = input('''
Please type in the math operation you would like to complete:
+ for addition
- for subtraction
* for multiplication
/ for division
''')
number_1 = int(input('Enter your first number :' ))
number_2 = int(input('Enter your second number :' ))
if operation == '+':
print('{} + {} = ' .format(number_1, number_2))
print(number_1 + number_2)
elif operation == '-':
print('{} - {} = ' .format(number_1, number_2))
print(number_1 - number_2)
elif operation == '*':
print('{} * {} = ' .format(number_1, number_2))
print(number_1 * number_2)
elif operation == '/':
print('{} / {} = ' .format(number_1, number_2))
print(number_1 / number_2)
else:
print('You have not typed a valid operator, please run the program again,')
again()
calculate()
def again():
calc_again =input('''
Do you want to calculate again?
Please type Y for YES or N for NO.
''')
if calc_again.upper() == 'Y':
calculate()
elif calc_again.upper() == 'N':
print('See you later.')
else:
again()
calculate()
```

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
ReplyReportHi there @vahegrigoryan5y,

Would you be able to provide further explanation on what you are expecting to this code to do, as well as where it is going wrong currently?

- Matt.