0

How do you use if else statements with input()??

I am playing around, trying to figure out certain things, and I am creating a conversation thread with my code where it takes user input, such as "hello, what is your name?" user inputs name, then code responds, repeating the users inputed name

25th Oct 2017, 9:19 PM
Andrew Pickett
3 Respostas
+ 1
# You should store the input in a variable. user_name = input("Enter your name: ") if (user_name == "Andrew"): print("Admin: Hello Andrew! How are you?") else: print("Admin: Sorry, " + user_name + "! I don't know you.")
25th Oct 2017, 10:10 PM
Boris Batinkov
Boris Batinkov - avatar
0
please share your code
25th Oct 2017, 10:03 PM
Daniel
Daniel - avatar
- 1
Edit tags to specify language you are using.
25th Oct 2017, 10:05 PM
John Wells
John Wells - avatar