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, 2019 in Python by Jinu
3,646 views

1 answer to this question.

–1 vote

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, 2019 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, 2019 in Python by Neha
406 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, 2019 in Python by Bheem
3,625 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
162 views
+1 vote
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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,572 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,191 views