Can someone help me finish this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can someone help me finish this?

I'm trying to complete like a questionnaire type deal or trivia game, whatever the actual name of the game 🤷🏾‍♀️. Basically the code was working fine until I got to the part where if they got the answer wrong. Basically if they get it and I want to print a stentment telling them to try again until they get it right. But no matter what I do , I get "invalid syntax" https://code.sololearn.com/ceFZjOY2Gd2A/?ref=app

18th Dec 2022, 8:13 AM
Kidale Smith
Kidale Smith - avatar
7 Answers
+ 2
I guess you want that program to say "wow" when the user type "nothing" the actual error is at `print(answer("haha try again: ")` you haven't declare any function name called `answer` so i assume you meant that `answer` as variable so i think you probably have to write it as answer = input("haha try again: ") and also you missed `:` at the end of line 11 then you used triple quote as command but it's not actually command but we can use it as command. Python actually takes that as literal but it just don't assign it to any variable but that as to follow python rules like indentation just put # or fix the indent at line 15
18th Dec 2022, 8:51 AM
Kishor Ramanan
Kishor Ramanan - avatar
+ 8
Kidale Smith Check your code it has indentation errors too
18th Dec 2022, 8:28 AM
Riya
Riya - avatar
+ 5
Have you checked what was your error message? You must put a colon : at the end of the 'if' statement
18th Dec 2022, 8:25 AM
Tibor Santa
Tibor Santa - avatar
+ 1
Thank you so much to everyone that answers and tried to help even with my typo "find" when I meant "finish". The program can now be completed and I can show my friends @Kishor Ramanan you gave me EXACTLY what I needed man you're AMAZING!! I been on this for 3 DAYS and it's as simple as moving indentation and changing a few words and BAM problem solved. haha so this is my beginner life of coding huh haha. When it's finished I'll upload it so you all can play around with it thank you so so so MUCH
19th Dec 2022, 7:10 AM
Kidale Smith
Kidale Smith - avatar
+ 1
Don't use the parenthesis at while statement; while answer != ("i don't know"): => while answer != "i don't know":
19th Dec 2022, 5:39 PM
Sedat Çapar
0
Great I spoke too soon, now I'm stuck again, I send the updated code and it has the same link
19th Dec 2022, 7:25 AM
Kidale Smith
Kidale Smith - avatar
0
Hey thanks, great advice, I didn't realize I could do that haha I'm learning so much. But with or without parenthesis, the code gets me past that point. It's something I'm going wrong after. I can't get past. Print("Wow")
19th Dec 2022, 6:41 PM
Kidale Smith
Kidale Smith - avatar