+ 1

Does the input function always takes inputs as strings?

26th Jan 2020, 3:41 PM
Hzkel
Hzkel - avatar
2 Respostas
+ 1
Yes, but you can convert it to other types if needed. For example, you can use int(input()) to convert input to an integer. input().split() will convert the input into a list, by spaces or any string you provide to it. There are a couple others.
26th Jan 2020, 4:26 PM
Jianmin Chen
Jianmin Chen - avatar
+ 5
Yes. https://docs.python.org/3/library/functions.html#input
26th Jan 2020, 3:43 PM
Hatsy Rei
Hatsy Rei - avatar