3

I started to program a few days ago and today I've tried to do the game 'Pong' using Python.

But since I am a beginner I can't find what is wrong with the code.

When I try to create a turtle.Turtle, the Pycharm says the code is unreachable.

 # Game Pong import turtle wn = turtle.Screen() wn.title("Quarentena 21/03") wn.setup(width=800, height=600) wn.bgcolor("black") wn.tracer(0) # Main Game Loop while True: wn.update() # Paddle A paddle_a = turtle.Turtle() paddle_a.shape("square") paddle_a.speed(0) paddle_a.color('green') paddle_a.penup() 
2
  • 2
    all the paddle_a code is unreachable, once your program gets to the while True it'll never go past that because it'll always be looping there Commented Mar 22, 2020 at 2:23
  • 1
    How would you ever get out of the while loop to get to the code below? Commented Mar 22, 2020 at 2:23

1 Answer 1

1

Yes, the code is unreachable. Unless you put something to break the loop, 'while True' continues forever because the default condition is always True unless you set it to false. So you can't reach the code below the loop. Happy programming! :)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.