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
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/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.