DEV Community

Rajkannan Rajagopal
Rajkannan Rajagopal

Posted on

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 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))

Top comments (0)