Mar-21-2021, 05:55 PM
No, they're not.
Should I move them to surround the try block? and take them off where they are now?
Please see below?
#User inputs math type
operation = input('''
Please type in the math operation you would like to complete:
+ for addition
* for multiplication
''')
#User inputs number
try:
number_1 = int(input('Enter your first number: '))
except Exception:
print: ("You have not input a number")
try:
number_2 = int(input('Enter your second number: '))
except Exception:
print: ("You have not input a number")
#If user chooses addition
if operation == '+':
print('{} + {} = '.format(number_1, number_2))
print(number_1 + number_2)
#if user chooses multiplication
if operation == '*':
print('{} * {} = '.format(number_1, number_2))
print(number_1 * number_2)
Should I move them to surround the try block? and take them off where they are now?
Please see below?
![Shy Shy](https://python-forum.io/images/smilies/shy.png)
#User inputs math type
operation = input('''
Please type in the math operation you would like to complete:
+ for addition
* for multiplication
''')
#User inputs number
try:
number_1 = int(input('Enter your first number: '))
except Exception:
print: ("You have not input a number")
try:
number_2 = int(input('Enter your second number: '))
except Exception:
print: ("You have not input a number")
#If user chooses addition
if operation == '+':
print('{} + {} = '.format(number_1, number_2))
print(number_1 + number_2)
#if user chooses multiplication
if operation == '*':
print('{} * {} = '.format(number_1, number_2))
print(number_1 * number_2)