+ 1
incorrect here guys
You need to put input (int (give me a number)) because input will automatically make it a string.
4 Respuestas
+ 1
Huh! Makes sense, I guess. Thanks for sharing.
+ 1
You may see a few examples like this; I finally decided they were going for clarity.
A couple places where string input might be desirable:
On hackerrank, one of the early challenges is to work with integers that are larger than can be stored in the data type; you could do this in a bridge string.
Scanners that inject keystrokes; they may read garbage, currency symbols, commas, () etc. You might want to catch/extra validate some of this before int/float/etc.
+ 1
I totally left out something from my Python study; I originally didn't follow it very far. Python supports arbitrary-precision integers...'big' integers limited by available memory. Included to support both Tom and my ramble.
- 1
you can also write as
int(input("enter value")) for taking input as integer
float(input("enter value))" for taking float as input
only writing input will be considered as string..
just remember to mention data type before input statement