0
Can someone please rewrite the code and point out the mistakes, please?And please explain me how does it work.
4 Answers
+ 2
You might start by adding the parentheses to the split call on line 2 so that it calls the method instead of just referring to it.
split() not split
You will also alway eventually get an error since you are using an infinite loop with no break. I.E. an EOF error will always happen
0
In the 2nd line it should be .split() instead of .split . Because split() is a method, not attribute.
Also in the last while loop, it will raise an error after all inputs are taken . That is because it is an infinite loop. So adding a try except will help the code to remain alive .
While True:
try:
get_input()
except:
print('game over')
break
break statement will help to get out of the infinite loop .
Hope these helps
https://code.sololearn.com/c7vhpnCPtudL/?ref=app
0
Thank you all..
0
'''If you want to say more than just one word you can change the code from
if len(command)>=2:
noun_word=command[1]
print(verb(noun_word))
And make it like this'''
if len(command)>=2:
noun_word = ""
for restofwords in command[1::]:
noun_word += " " + restofwords
print(verb(noun_word))
''' This way the code takes all the words in the list after the verb and outputs them together '''