0

For Python, how do I respond to an input?

For ex. I say print(input("What\' your name")) and I want to say on a different line, "That's a nice name", how do I do it?

25th Nov 2016, 8:18 AM
Aaryan Rampal
Aaryan Rampal - avatar
2 ответов
+ 5
You could possibly make a name variable in which it'll take user input. So something like: user_name = input("Please enter your name: ") Then on the next line you could simply use the print function, to display what ever was entered with a comment: print ("Hey %s, that's a nice name!" % (user_name))
26th Nov 2016, 7:42 AM
Don
Don - avatar
+ 1
First, after making the input method and preferred command, Run it and the will get the command back(usually in question form), simply reply and that's about it...but don is correct
1st Dec 2016, 4:40 PM
Randy
Randy - avatar