Ved Pawar
Ved Pawar

Reputation: 148

Why does my turtle window close immediately?

import turtle

ved_turtle = turtle.Turtle()
def square():
    ved_turtle.forward(100)
    ved_turtle.right(90)
    ved_turtle.forward(100)
    ved_turtle.right(90)
    ved_turtle.forward(100)
    ved_turtle.right(90)
    ved_turtle.forward(100)
    ved_turtle.right(90)

elephant_weight = 3000
ant_weight = 0.1

if elephant_weight < ant_weight:
    square()
else:
    ved_turtle.forward(0)

Why does my turtle window close immediately after opening in the community edition of Visual Studio 2019, but it does not close immediately in repl.it ?

Upvotes: 0

Views: 97

Answers (1)

HotFondue
HotFondue

Reputation: 28

Add input() at the end of the script to make it wait for the Enter key.

Upvotes: 1

Related Questions