Python : Simple Calculator

Today I learned about doing simple calculator arithmetic operations,
IF… ELSE… ELIF… statement and WHILE loop.

Also one learner asked about
num1 = input(“Enter First number : “)
choice = input(“Enter the Choice : “)
num2 = input(“Enter Second n…


This content originally appeared on DEV Community and was authored by Rajkannan Rajagopal

Today I learned about doing simple calculator arithmetic operations,
IF... ELSE... ELIF... statement and WHILE loop.

Also one learner asked about
num1 = input("Enter First number : ")
choice = input("Enter the Choice : ")
num2 = input("Enter Second number : ")
print ((num1)(choice)(num2)) # expected to print 9 for the input 4 + 5

This will Error out. But still possible to get result using eval.

print(eval(num1+choice+num2))


This content originally appeared on DEV Community and was authored by Rajkannan Rajagopal


Print Share Comment Cite Upload Translate Updates
APA

Rajkannan Rajagopal | Sciencx (2024-07-15T16:35:13+00:00) Python : Simple Calculator. Retrieved from https://www.scien.cx/2024/07/15/python-simple-calculator/

MLA
" » Python : Simple Calculator." Rajkannan Rajagopal | Sciencx - Monday July 15, 2024, https://www.scien.cx/2024/07/15/python-simple-calculator/
HARVARD
Rajkannan Rajagopal | Sciencx Monday July 15, 2024 » Python : Simple Calculator., viewed ,<https://www.scien.cx/2024/07/15/python-simple-calculator/>
VANCOUVER
Rajkannan Rajagopal | Sciencx - » Python : Simple Calculator. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/15/python-simple-calculator/
CHICAGO
" » Python : Simple Calculator." Rajkannan Rajagopal | Sciencx - Accessed . https://www.scien.cx/2024/07/15/python-simple-calculator/
IEEE
" » Python : Simple Calculator." Rajkannan Rajagopal | Sciencx [Online]. Available: https://www.scien.cx/2024/07/15/python-simple-calculator/. [Accessed: ]
rf:citation
» Python : Simple Calculator | Rajkannan Rajagopal | Sciencx | https://www.scien.cx/2024/07/15/python-simple-calculator/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.