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

Purpose?

What’s a scenario where you would want or need to type int(“2”) + int(“3”) instead of simply 2 + 3?

15th Aug 2019, 10:05 PM
Sam Hatchard
Sam Hatchard - avatar
2 Answers
+ 3
When you receive user input. It is a string when you get it. Let's say, a simple addition calculator. num1 = int(input("Enter a number")) num2 = int(input("Enter another number")) print(num1+num2)
15th Aug 2019, 10:08 PM
Paul Grasser
Paul Grasser - avatar
0
thanks!
15th Aug 2019, 10:29 PM
Sam Hatchard
Sam Hatchard - avatar