Skip to content

Instantly share code, notes, and snippets.

@FONQRI
Last active April 21, 2022 09:35
Show Gist options
  • Save FONQRI/866439eb7af8640e4cd7 to your computer and use it in GitHub Desktop.
Save FONQRI/866439eb7af8640e4cd7 to your computer and use it in GitHub Desktop.
A python3 calculator in one line
print(eval(input('Please enter your arithmetic expression :' )))
@FONQRI
Copy link
Author

FONQRI commented Mar 6, 2016

Hi
You should use python 3.x for this calculator to get the answer because in python 3.x our inputs are strings but in python 2.x our inputs aren't strings and we don't need to get an eval of that so our code will be like this in python 2.x
print(input('Please enter your arithmetic expression :' ))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment