what do i have to do to make this work | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

what do i have to do to make this work

--- = tab while True: ---userInput = input(">>> ") ---if userInput in ['hi', 'HI', 'Hi']: ------print("Hello") ---else: ------print("I did not understand what you said")

23rd Dec 2016, 10:20 PM
code-junkie
code-junkie - avatar
5 Réponses
+ 1
What is this piece of code supposed to do?
23rd Dec 2016, 10:40 PM
Rishi Anand
Rishi Anand - avatar
+ 1
Whatever. Use this. while True: try: userInput = input() if userInput in ["hi", "HI", "Hi"]: print("Hello") else: print("I did not understand what you said") except EOFError: break
24th Dec 2016, 1:47 AM
Rishi Anand
Rishi Anand - avatar
0
# the online testing environment is not setup # to accept repeated input with python the best # it does is handle a single entry userInput = input("You say : ") if userInput in ['hi', 'HI', 'Hi']: print(userInput, ' I say Hello') else: print(userInput, " I say I did not understand you")
24th Dec 2016, 1:28 AM
richard
0
it's ai
24th Dec 2016, 1:33 AM
code-junkie
code-junkie - avatar
0
thank you guys
24th Dec 2016, 2:12 AM
NET__RYDER™
NET__RYDER™ - avatar