Guest User

Untitled

a guest
Jan 14th, 2020
59
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def figures(x, y, start_angle, step, length):
  2.     start_point = sd.get_point(x, y)
  3.     end_point = sd.get_point(x, y)
  4.     for angle in range(0, 360 - step, step):
  5.         vector = sd.get_vector(start_point=start_point, angle=angle + start_angle, length=length, width=2)
  6.         vector.draw()
  7.         start_point = vector.end_point
  8.     sd.line(start_point=start_point, end_point=end_point, width=2)
  9.  
  10.  
  11. def triangle():
  12.     figures(100, 100, 10, 120, 100)
  13.  
  14.  
  15. def square():
  16.     figures(300, 100, 10, 90, 100)
  17.  
  18.  
  19. def pentagon():
  20.     figures(100, 300, 10, 72, 100)
  21.  
  22.  
  23. def hexagon():
  24.     figures(300, 300, 10, 60, 100)
  25.  
  26.  
  27. figures_total = {
  28.     '0': {'figure_name': 'triangle', 'sd.name': triangle()},
  29.     '1': {'figure_name': 'square', 'sd.name': square()},
  30.     '2': {'figure_name': 'pentagon', 'sd.name': pentagon()},
  31.     '3': {'figure_name': 'hexagon', 'sd.name': hexagon()},
  32. }
  33. for number, figure in figures_total.items():
  34.     print(number, ' - ', figure['figure_name'])
  35.  
  36. figure_1 = input("Введите, пожалуйста, номер фигуры: ")
  37.  
  38. if figure_1 in figures_total:
  39.     triangle(figures_total[figure_1]['sd.name'])
  40.     square(figures_total[figure_1]['sd.name'])
  41.     pentagon(figures_total[figure_1]['sd.name'])
  42.     hexagon(figures_total[figure_1]['sd.name'])
  43.     sd.pause()
  44. else:
  45.     print('Вы что-то напутали. Попробуйте еще раз!')
RAW Paste Data