how to make a hexgone of equal side length using tuple in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to make a hexgone of equal side length using tuple in python

I need to make a hexgone in pythone using tuple set etc and i can not make it i need help any one who can give me the solution

4th Apr 2020, 3:59 AM
Shams Ul Islam
Shams Ul Islam - avatar
7 Answers
+ 1
import turtle t = turtle.Turtle() numberOfSides = int(input('Enter the number of sides of a polygon: ')) lengthOfSide = int(input('Enter the length of a side of a polygon: ')) exteriorAngle = 360/numberOfSides for i in range(numberOfSides): t.forward(lengthOfSide) t.right(exteriorAngle)
7th Apr 2020, 6:32 PM
Shams Ul Islam
Shams Ul Islam - avatar
+ 3
import turtle  # importing python turtle graphics polygon = turtle.Turtle() # calling Turtle function from turtle library sides = 6                 # hexagon has six sides, you can make any polygon of any no. of sides side_length = 70          # length of each side angle = 360.0 / sides     # angle is 360 divided by no. of sides for i in range(sides):          # loop     polygon.forward(side_length) # drawing start for lengh of a side     polygon.right(angle)         # right turns it clockwise turtle.done()                    # prints turtle on screen # hope you understood my language # remember it won't work on SOLOLEARN because turtle graphics can't be used in SOLOLEARN # run it on python IDLE # you can also define colors of lines, fill color etc
6th Apr 2020, 11:48 AM
JAHANGEER LATEEF WANI
JAHANGEER LATEEF WANI - avatar
+ 1
JAHANGEER LATEEF WANI :D I was curious to know what's the OP means by "make hexagon ... using tuple": you have probably found the hidden meaning of the question ;)
6th Apr 2020, 11:52 AM
visph
visph - avatar
0
i am not getting your point of using a tuple, for what u will use tuple
6th Apr 2020, 11:54 AM
JAHANGEER LATEEF WANI
JAHANGEER LATEEF WANI - avatar
0
I don't know too for what, but these are the OP question words ^^
6th Apr 2020, 11:56 AM
visph
visph - avatar
0
message me inbox, i will make u understand
6th Apr 2020, 11:57 AM
JAHANGEER LATEEF WANI
JAHANGEER LATEEF WANI - avatar
0
this is for polygon
7th Apr 2020, 6:32 PM
Shams Ul Islam
Shams Ul Islam - avatar