How do I draw a hexagon using the turtle module of python?

0 votes
How do I draw a hexagon using the turtle module of python? I'm very new to this module and need it for an assignment. Any help will be appreciated. Thank you
Jun 21 in Python by Jinu
284 views

1 answer to this question.

0 votes

Hey @Jinu, try this:

import turtle 
polygon = turtle.Turtle() 
num_sides = 6
side_length = 70
angle = 360.0 / num_sides 
for i in range(num_sides): 

    polygon.forward(side_length) 

    polygon.right(angle) 

turtle.done() 
answered Jun 23 by Haseeb

Related Questions In Python

0 votes
1 answer

How do I create a star using the turtle module of python?

Hey @Jinu, Try something like this: import turtle star = ...READ MORE

answered Jun 21 in Python by Neha
61 views
0 votes
1 answer

How do I draw a semi-circle only using turtle - Python

Try this: import turtle turtle = turtle.Pen() turtle.left(90) for x in ...READ MORE

answered Jul 5 in Python by Bheem
272 views
+2 votes
1 answer

How can I record the X,Y limits of a displayed X,Y plot using the matplotlib show() module?

A couple hours after posting this question ...READ MORE

answered Dec 27, 2018 in Python by anonymous
84 views
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 333 views
+4 votes
6 answers