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

Input and user input

If I code an input line, how can I use what the user enters, and have following code respond to it. For example If I ask the user to input(original) a response and I want the next input code to vary depending on what the user enters on the original input. how would I write that?

25th Nov 2018, 9:30 PM
Christopher Alvarez
2 Answers
+ 2
I'm afraid on Sololearn we can't take a second input based on the first. All the inputs must be provided together at beginning. But you can certainly do it in any offline Python editor using the method HonFu suggested.
26th Nov 2018, 4:01 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 1
First you need to store the inout of the user in a variable. x = input() And the content of x (always a string) can be used now to steer program flow: if x == ...: ...
25th Nov 2018, 10:26 PM
HonFu
HonFu - avatar