Help me in error line no 18 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
25th Jul 2021, 3:34 AM
Vibhor Kumar
3 Answers
+ 1
import random Name=Input("what is your name") print("good luck."+Name) word=['hunter','gamer','father','colourful','computer'] #here you override word variable from list to string!! #instead better to use words for list and word for string word=random.choice(word) print ("guess the word") gues="" turn=10 while turn>0: faild=0 else: print("") faild +=1 if faild ==0: print("you win") guess=input("guess a word") gues+=guess here you forgot to end the line with colon <:> if guess not in word turn-=1: print("worng") print("you have"+turn) if turn==0: print("you lose")
25th Jul 2021, 6:25 AM
Shadoff
Shadoff - avatar
+ 1
if guess not in word: turn-=1 (line 18 should end in colon ":" and not line 19) (if and else ends in colon :)
25th Jul 2021, 3:38 AM
Rohit
0
BLACK GAMING And also there is a problem on line number 2, 21 and 23 I had already given you solution but you still didn't change anything in your code and came with same problem. Why? You should give your effort man. https://code.sololearn.com/ckwa4Bka3eZt/?ref=app
25th Jul 2021, 5:04 AM
A͢J
A͢J - avatar