repl.it
@Caoyq1992/

10.9.1

Python (with Turtle)

No description

fork
loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import turtle

t=turtle.Turtle()

# s=int(input('Number of sides of the shape:'))

# for i in range (s):
#   t.forward(75)
#   t.left(360/s)

mode=True


def draw_shape(trt,sides):
# Python do not round up the integer/integer
  turning_angle=360/float(sides)
  for i in range(sides):
    if mode:
      print('iteration: ',i)
    trt.forward(55)
    trt.left(turning_angle)

alex=turtle.Turtle()
num_sides=int(input('Number of sides:'))
draw_shape(alex,num_sides)



result
console