Last active
April 12, 2017 17:03
-
-
Save evangelinaf/1c5ccf8725937feb47870e112451a320 to your computer and use it in GitHub Desktop.
Simple Python calculator for RC event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n1 = int(input('Enter the first number: ')) | |
n2 = int(input('Enter the second number: ')) | |
calculate = input(''' | |
For addition, type + | |
For subtraction, type - | |
For multiplication, type * | |
For division, type / | |
For remainder, type % | |
''') | |
if calculate == '+': | |
print('{} + {} = '.format(n1, n2)) | |
print(n1 + n2) | |
elif calculate == '-': | |
print('{} - {} = '.format(n1, n2)) | |
print(n1 - n2) | |
elif calculate == '*': | |
print('{} * {} = '.format(n1, n2)) | |
print(n1 * n2) | |
elif calculate == '/': | |
print('{} / {} = '.format(n1, n2)) | |
print(n1 / n2) | |
elif calculate == '%': | |
print('{} % {} = '.format(n1, n2)) | |
print(n1 % n2) | |
else: | |
print('You havent typed a valid operation, please run the program again') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment