Simple calculator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Simple calculator

For the simple calculator, I wrote: x = int(input()) y = int(input()) #calculates the amount total = (x + y) print(total) Use to pass the challenge if you'd like. Does this look right to everyone else? Is there a better way?

7th Jan 2022, 6:16 PM
Jason Janis
4 Answers
+ 1
x=int(input()) y=int(input()) print(x+y) Or print(int(input())+int(input()))
8th Jan 2022, 3:05 AM
NEZ
NEZ - avatar
0
a = input("first number: ") or '2' b = input("second number: ") or '3' print(f'{int(a)+int(b)}') print(eval(a+'+'+b)) print(int(a)+int(b))
7th Jan 2022, 6:24 PM
Shadoff
Shadoff - avatar
0
So what is your question?
7th Jan 2022, 6:44 PM
A͢J
A͢J - avatar
0
NEZ, I really like your reply. Thank you for the help
8th Jan 2022, 10:20 PM
Jason Janis