Skip to content

Instantly share code, notes, and snippets.

@peroh215
Created November 13, 2018 21:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peroh215/eb7aaea13b461aa7987d0eebae0aa489 to your computer and use it in GitHub Desktop.
Save peroh215/eb7aaea13b461aa7987d0eebae0aa489 to your computer and use it in GitHub Desktop.
Shortest calculator possible in Python
#!/usr/bin/env python
try:
usr = input('Enter operation: ')
pu = int(eval(usr))
print(pu)
except NameError as ne:
print('You need to enter a mathematical operation')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment