Why my code given me error’s # Python code to draw snowflakes fractal. import turtle import random # setup the window with a background color wn = turtle.Screen() wn.bgcolor("cyan") # assign a name to your turtle elsa = turtle.Turtle() elsa.speed(15) # create a list of colours scolor = ["white", "blue", "purple", "grey", "magenta"] # create a function to create different size snowflakes def snowflake(size): # move the pen into starting position elsa.penup() elsa.forward(10*size) elsa.left(45) elsa.pendown() elsa.color(random.choice(sfcolor)) # draw branch 8 times to make a snowflake for i in range(8): branch(size) elsa.left(45) # create one branch of the snowflake def branch(size): for i in range(3): for i in range (3): elsa.forward(10.0*size/3) # draw branch 8 times to make a snowflake for i in range(8): branch(slice) elsa.left(45) # create one branch of the snowflake def branch (size): for i in range(3): for i in range(3): elsa.forward(10.0*size/3) elsa.backward(10.0*size/3) elsa.right(45) elsa.left(90) elsa.backward(10.0*size/3) elsa.left(45) elsa.right(90) elsa.forward(10.0*size) # loop to create 20 different sized snowflakes # with different starting co-ordinates for i in range (20): x = random.randint(-200, 200) y = random.randint(-200, 200) sf_size = random.randint(1, 4) elsa.penup() elsa.goto(x, y) elsa.pendown() snowflake(sf_size) wn.exitonclick()

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Why my code given me error’s # Python code to draw snowflakes fractal. import turtle import random # setup the window with a background color wn = turtle.Screen() wn.bgcolor("cyan") # assign a name to your turtle elsa = turtle.Turtle() elsa.speed(15) # create a list of colours scolor = ["white", "blue", "purple", "grey", "magenta"] # create a function to create different size snowflakes def snowflake(size): # move the pen into starting position elsa.penup() elsa.forward(10*size) elsa.left(45) elsa.pendown() elsa.color(random.choice(sfcolor)) # draw branch 8 times to make a snowflake for i in range(8): branch(size) elsa.left(45) # create one branch of the snowflake def branch(size): for i in range(3): for i in range (3): elsa.forward(10.0*size/3) # draw branch 8 times to make a snowflake for i in range(8): branch(slice) elsa.left(45) # create one branch of the snowflake def branch (size): for i in range(3): for i in range(3): elsa.forward(10.0*size/3) elsa.backward(10.0*size/3) elsa.right(45) elsa.left(90) elsa.backward(10.0*size/3) elsa.left(45) elsa.right(90) elsa.forward(10.0*size) # loop to create 20 different sized snowflakes # with different starting co-ordinates for i in range (20): x = random.randint(-200, 200) y = random.randint(-200, 200) sf_size = random.randint(1, 4) elsa.penup() elsa.goto(x, y) elsa.pendown() snowflake(sf_size) wn.exitonclick()
size
32
33
# draw branch 8 times to make a snowflake
ns
34- for iin
(8):
branch(
elsa.left(45)
35
36
37
38
# create one branch of the snowflake
39- def branch (size):
for i in
(3):
(3):
40
for i in
elsa.forward(10.0*size/3)
elsa.backward(10.0*size/3)
elsa.right(45)
elsa.left(90)
elsa.backward(10.0*size/3)
elsa.left(45)
41-
42
43
44
45
46
47
input
Traceback (most recent call last):
File "main.py", line 5, in <module>
wn = turtle.Screen()
File "/usr/lib/python3,B/turtle.py", line 3663, in Screen
Turtle._screen = _Screen ()
File "/usr/1ib/python3.8/turtle.py", line 3679, in
Screen._root = self. root =_Root ()
File "/usr/1ib/python3.B/turtle.py", line 435, in _init_
TK.Tk._init_(self)
File "/usr/lib/python3.8/tkinter/_init_-py", line 2270, in
self.tk =
tkinter.TclError: couldn't connect to display ":1"
init
_init
tkinter.create (screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
... Program finished with exit code 0
Press ENTER to exit console.
Js GDB
4:26 PM
3/13/2022
51
Transcribed Image Text:size 32 33 # draw branch 8 times to make a snowflake ns 34- for iin (8): branch( elsa.left(45) 35 36 37 38 # create one branch of the snowflake 39- def branch (size): for i in (3): (3): 40 for i in elsa.forward(10.0*size/3) elsa.backward(10.0*size/3) elsa.right(45) elsa.left(90) elsa.backward(10.0*size/3) elsa.left(45) 41- 42 43 44 45 46 47 input Traceback (most recent call last): File "main.py", line 5, in <module> wn = turtle.Screen() File "/usr/lib/python3,B/turtle.py", line 3663, in Screen Turtle._screen = _Screen () File "/usr/1ib/python3.8/turtle.py", line 3679, in Screen._root = self. root =_Root () File "/usr/1ib/python3.B/turtle.py", line 435, in _init_ TK.Tk._init_(self) File "/usr/lib/python3.8/tkinter/_init_-py", line 2270, in self.tk = tkinter.TclError: couldn't connect to display ":1" init _init tkinter.create (screenName, baseName, className, interactive, wantobjects, useTk, sync, use) ... Program finished with exit code 0 Press ENTER to exit console. Js GDB 4:26 PM 3/13/2022 51
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY