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

Input vs Int Input

I'm a bit confused on these. So far I've learned that input() will bring a box for the user to input information to then be printed. What I don't understand is when you add INT to the function, it doesn't do that (at least I haven't seen in it) Is there something that I'm missing?

8th Feb 2024, 3:28 PM
Nicole Krason
4 Answers
+ 7
By default, input() take "text or string" as input. Eg, day = input() print(day) In your input box, when you input "monday" it prints "monday" as your output. input () - does not take integer values Whereas, int(input()) - takes only integer values. If you write any text in your int(input()) it will throw you error.
8th Feb 2024, 3:42 PM
D Shah 🎯⏳️
D Shah 🎯⏳️ - avatar
+ 7
Int() is masked over input() for getting -> integer values. So the box you get is only for input. You have to have use int() function nested with input() then only you get output as integer.
8th Feb 2024, 4:22 PM
D Shah 🎯⏳️
D Shah 🎯⏳️ - avatar
+ 1
D Shah 🎯⏳️ This makes much more sense now! Thank you so much for helping me with all of my questions!
8th Feb 2024, 4:23 PM
Nicole Krason
0
D Shah 🎯⏳️ So you won't get a box to write anythihng in with INT, only with input by itself?
8th Feb 2024, 4:18 PM
Nicole Krason