Draw the following figure with python turtle

Dennis Podbicanin 96 Reputation points
2020-05-22T10:45:42.563+00:00

Hello, I have to draw the following figure with turtle in python. I have achieved the following:

import turtle  
  
turtle.speed(25)  
length = 30  
turtle.x = 25  
turtle.y = 25  
def draw_rhombus():  
    for i in range(1, 3):  
        turtle.forward(length)  
        turtle.left(180 - 130)  
        turtle.forward(length)  
        turtle.left(130)  
def draw_octagon(d):  
    for i in range(8):  
       turtle.forward(d)  
       turtle.right(360/8)  
for i in range(7):  
    draw_rhombus()  
    turtle.right(50)  
turtle.right(35)  
for i in range(7):  
    draw_rhombus()  
    turtle.right(50)  
turtle.penup()  
turtle.forward(80)  
turtle.pendown()  
turtle.right(110)  
draw_octagon(60)  
  
turtle.mainloop()  

But I can't draw the second octagon. Can you help me?
Please excuse the wrong Q&A tag because I couldn't find one for the Python programming language.

Figure: 8496-download.png

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,690 questions
0 comments No comments
{count} votes

Accepted answer
  1. Dennis Podbicanin 96 Reputation points
    2020-05-29T20:53:02.743+00:00

    I found this solution:

    import turtle
    for i in range(12):
        for j in range(6):
            turtle.forward(80)
            turtle.left(60)
        turtle.left(30)
    
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.