Skip to content

Instantly share code, notes, and snippets.

@evangelinaf
Last active April 12, 2017 17:03
Show Gist options
  • Save evangelinaf/1c5ccf8725937feb47870e112451a320 to your computer and use it in GitHub Desktop.
Save evangelinaf/1c5ccf8725937feb47870e112451a320 to your computer and use it in GitHub Desktop.
Simple Python calculator for RC event
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