Advertisement
plarmi

work11_1

Jun 2nd, 2023
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.33 KB | None | 0 0
  1. import turtle                                        
  2. import math                                          
  3. t = turtle.Turtle()                                  
  4. t.shape('turtle')                                    
  5. R = 30                                                
  6. x = 1                                                
  7. n = 3                                                
  8. t.up()                                                
  9. t.goto(R, 0)                                          
  10. t.down()                                              
  11. def polygon(x):                                      
  12.     while x <= n:                                    
  13.         t.left((180 - 360 / n) / 2)                  
  14.         t.left(360 / n)                              
  15.         t.forward(2 * R * math.sin(math.pi/n))        
  16.         x += 1                                        
  17.         t.right((180 - 360 / n) / 2)                  
  18. while n <= 11:                                        
  19.     polygon(x)                                        
  20.     n += 1                                            
  21.     R += 18                                          
  22.     t.up()                                            
  23.     t.goto(R, 0)                                      
  24.     t.down()                                          
  25. turtle.exitonclick()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement