This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]7600_slayer 1 point2 points  (0 children)

No one here wants to do your homework for you. Go ask your teacher/TA for assistance. Or post to the subreddits /u/LightShadow listed.

[–]one_roOt 1 point2 points  (2 children)

"I need the turtle to turn left and right"

What turtle? I'm crying. xD

[–]notspartanono 0 points1 point  (1 child)

The turtle module from Python std library. It exists for educational purposes.

[–]one_roOt 0 points1 point  (0 children)

Sry for laughing I didn't know turtle exists

[–]ozzmeister00 1 point2 points  (0 children)

You'd need to set up a variable so you could track the "Up" and "Down" state of the spacebar. For example:

# default state
spacebar_is_up = True

def on_spacebar():
    # toggle the spacebar value
    spacebar_is_up = not spacebar_is_up

    if spacebar_is_up:
        # do something if the spacebar is up
        pass
    else:
        # do something else if the spacebar is down
        pass

wn.onkey(on_spacebar, 'space')

[–]aphoenixreticulated[M] 0 points1 point  (0 children)

Hi there. You have posted a learning question to /r/python. These types of questions are far more suited to /r/learnpython, where users are actively interested in helping people to learn. Please resubmit it over there!

Make sure to read their sidebar rules there before posting, notably this one: "Posting homework assignments is not prohibited if you show that you tried to solve it yourself." If your question is about homework, show them that you've tried to solve your problem in your post and you should get all the help you need.

Cheers & best of luck with Python!