0

why is this code not running

import turtle # Create a turtle object t = turtle.Turtle() # Draw a square shape for i in range(4): t.forward(100) t.right(90) # Exit the turtle window turtle.done()

25th Feb 2023, 8:45 AM
Jatin Rajpoot
Jatin Rajpoot - avatar
5 Answers
+ 4
Runs like a charm See line 16ff in html https://code.sololearn.com/WFNiN9O218sI/?ref=app
25th Feb 2023, 2:37 PM
Oma Falk
Oma Falk - avatar
+ 6
Sololearn does not support turtle module by default
25th Feb 2023, 8:50 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
+ 1
you can use __import__("os").system("pip -qqq install turtle") to install turtle, but because tkinter does not work on sololearn, you will get error below even after you have turtle installed. import turtle # import turtle File "../Playground//turtle.py", line 107, in <module> import tkinter as TK File "../Playground//tkinter/__init__.py", line 36, in <module> import _tkinter # If this fails your Python may not be configured for Tk ImportError: libtk8.6.so: cannot open shared object file: No such file or directory
25th Feb 2023, 2:50 PM
o.gak
o.gak - avatar
+ 1
Oma Falk Skulpt So cool!
25th Feb 2023, 3:00 PM
o.gak
o.gak - avatar
+ 1
Oma Falk have to add this line wn = turtle.Screen() to call wn.exitonclick()
25th Feb 2023, 3:11 PM
o.gak
o.gak - avatar