Ask coding questions

← Back to all posts
What is wrong with this code?
DJWang (1202)

what is wrong with this code:

def aimTarget():
for meteor in meteors:
if laser.xcor() = meteor.xcor() and laser.ycor() = meteor.ycor:
meteor.goto(meteor.xcor() - random.randint(1,15)

Answered by JoshDaBosh (79) [earned 5 cycles]
View Answer
JoshDaBosh (79)

first off, you should indent your code to make it more readable.

in line 3: replace the single equal signs with double equal signs
in line 4: you're missing an ending parenthesis after random.randint(1, 15)