Ask coding questions

← Back to all posts
Help me for this project
pikachu223 (0)

Help me for this project Animal Trivia

Comments
hotnewtop
ZarmDev (8)

I fixed the errors: https://replit.com/@ZarmDev/Animal-Trivia#main.py But your code is confusing and doesn't seem to work.
Your code also repeats forever, and when the function is called, you need to add arguments, possibly do this a different way or find some solution?

ZarmDev (8)

I think you should do a different approach, but if you really want to do recursion you can but I don't know how to fix this :/

CodeMaster007 (90)

Hey! So in your code, it says

print('answer correct')

This is the format for python 2. For python 3, you do ". Heres a example...

print("Hello World!") #this is python 3

print('Hello World!') #this is python 2

I see a few more errors but this should be a good start for everything else. You mixed python 2 with 3 in a few parts so look carefully.
If you have any other questions, add me to the doc and I'll help you with it
Thanks,

CodeMaster007

pikachu223 (0)

@CodeMaster007 and this:File "main.py", line 9
if attempt < 2
^
SyntaxError: invalid syntax

CodeMaster007 (90)

You have too large of a space. Like a tab on the keyboard . Click backspace till its just one ahead. @pikachu223

ZarmDev (8)

@pikachu223 if attempt < 2:
you need a ":"

CodeMaster007 (90)

Ok. So maybe hello world works in 3 but other commands do not. There is a reason why there are 2 different pythons. Python 2 and 3. @doineednumbers

doineednumbers (26)

@CodeMaster007 There's also a reason why they're both python. I think you're thinking of the difference between print "hi" and print("hi")