How can I separate the two entries in a calculator using Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I separate the two entries in a calculator using Python?

paython

18th Mar 2021, 11:14 AM
‎Sohaila Sherif Omar
‎Sohaila Sherif Omar - avatar
3 Answers
+ 4
Please can you explain your question abit . I don't know if you are taking about the input or what Thsnks
18th Mar 2021, 11:19 AM
!Derrickee
!Derrickee - avatar
0
x=int(6+3) print (x) x=int(11+22) print (x) In these codes, I want the output to be the first or second code
18th Mar 2021, 11:22 AM
‎Sohaila Sherif Omar
‎Sohaila Sherif Omar - avatar
0
you don't need to enclose your operation inside int() call... int() is used to convert something to int... but result of int+int is still an int. to output one code or another you need an 'if...else' conditional statement, but you should determine on wich condition wich output will be printed ^^
18th Mar 2021, 11:32 AM
visph
visph - avatar