How could I fix or improve this code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How could I fix or improve this code.

I am trying to make this code to run continually. Whenever I try to run two inputs it has a string line error 1, command ("insert input here"). I want to why this won't work(I am kind of new to Python ,but not programming so sorry if this is a simple question). Also if you have anything to add to improve it I will listen to it. INPUT = input().lower() if INPUT in['hi', 'hello'] : print("\nComputer:Hello") elif INPUT in['goodbye', 'bye']: print("\nComputer:Bye") else: print('Sorry can you repeat that please')

19th Jun 2018, 11:59 PM
Nate Bowles
3 Answers
+ 11
... Try including a loop in your code. Like most languages, instructions will only be executed once in python unless you instruct otherwise https://www.sololearn.com/learn/Python/2435/?ref=app
20th Jun 2018, 12:10 AM
jay
jay - avatar
+ 1
Thank you, I will try that.
20th Jun 2018, 12:51 AM
Nate Bowles
+ 1
Thank you, that worked very well.
20th Jun 2018, 1:15 AM
Nate Bowles