+ 2

How to use multiple input commands in python?

I’m working on a Todo List program and I need to use multiple input commands, but when I run my code the first input command works and the code displays the text but then an error pops up. Help? Here’s the code in question. list = ["Nothing", "Nothing", "Nothing"] x = input() list[0] = x print("TODO:") print(list[0]) y = input() list[1] = y print(list[1]) z = input() list[2] = z print(list[2])

26th Dec 2017, 8:56 PM
RuthlessDust
RuthlessDust - avatar
2 Réponses
+ 10
The code runs fine, although it would do better with a for loop or something. The reason you are getting an error in Sololearn is that it accepts user input in a weird way - you have to provide all the input at once, with every single input in one line.
26th Dec 2017, 9:52 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
@Kuba Thanks!
26th Dec 2017, 9:58 PM
RuthlessDust
RuthlessDust - avatar