Question

Write a code to draw the following pattern:

(ON PYTHON IDLE 3.7.2)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code:

#spiral patterns using for loop and turtle and turtle used for draw patterns.
#import turtle.
from turtle import *
setup(500,500) #make window of size 500*500 pixels
t1 = Turtle() # let make a tutrle to build graphics
t1.hideturtle() # intitally hide turtle
for i in range(10,110,5): # loop from point 10 pixel and step size 5 upto 110 pixels
t1.forward(i) # move forward i pixels
t1.left(90) # move counter clockwise of 90 degree for square 90 degrees

screenshot:

neid.py-CAUserstharu 000.Desktoplnend.py (3.5.2) File Edit Format Run Options Window Help #spiral patterns using for loop andL nend.py-CNUsersithan_000Desktopinew4.ру (352) File Edit Format Run Options Window Help #spiral mportPython 3.5.2 Shell rom

if you want color then code is:

#spiral patterns using for loop and turtle and turtle used for draw patterns.
#import turtle.
from turtle import *
setup(500,500) #make window of size 500*500 pixels
t1 = Turtle() # let make a tutrle to build graphics
t1.hideturtle() # intitally hide turtle
t1.color("blue") #for color blue
for i in range(10,110,5): # loop from point 10 pixel and step size 5 upto 110 pixels
t1.forward(i) # move forward i pixels
t1.left(90) # move counter clockwise of 90 degree for square 90 degrees

output:

L nend.py-CNUserstharu,000.Desktopinew4.ру (352) File Edit Format Run Options Window Help #spiral patterns using for loop and

Add a comment
Know the answer?
Add Answer to:
(ON PYTHON IDLE 3.7.2) Write a code to draw the following pattern: Write a code to draw the following pattern:
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT