Ask coding questions

← Back to all posts
How to fix ParseError on line 109
IndyRishi (79)

This is a turtle racing repl with an error. FIX IT plz.

Answered by Wilke000 (504) [earned 5 cycles]
View Answer
Commentshotnewtop
PattanAhmed (1367)

@IndyRishi Hi,
There are some silly errors in your program.
Invite me to your Repl to fix it.
or
I think this might be your solution.
Change all your code from line 107:-

elif racer.xcor() > racer2.xcor()  and racer.xcor() > racer3.xcor():
  print('Racer-1 won!')
	if teamToWin == racerIs1:
		print('You guessed right!')
		
elif racer.xcor() == racer2.xcor():
  print('Racer-1 and Racer-2 tied!')
	if teamToWin == racerIs1 or teamToWin == racerIs2: 
		print('You guessed right!')
elif racer.xcor() == racer3.xcor():
  print('Racer-1 and Racer-3 tied!')
	if teamToWin == racerIs1 or teamToWin == racerIs3:
		print('You guessed right!')
elif racer2.xcor() == racer3.xcor():
  print('Racer-2 and Racer-3 tied!')
	if teamToWin == racerIs2 or teamToWin == racerIs3:
		print('You guessed right!')

Try and tell me the results.
Thanks!

Hope this helps!

IndyRishi (79)

Thank you for trying to help! I tried your suggestions but they didn't work.

RYANTADIPARTHI (3348)

you put an or without actually checking the statement:

Code should looks like this:

if teamToWin == racerIs1 or teamToWin == racerIs2: 

That should work