-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathfonctions_3.py
More file actions
100 lines (77 loc) · 1.25 KB
/
fonctions_3.py
File metadata and controls
100 lines (77 loc) · 1.25 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
##############################
# Fonctions
##############################
##############################
# Activité 3 - Tortue
##############################
from turtle import *
width(5) # Epaisseur du trait
##############################
## Question 1 ##
def triangle():
color('red')
forward(200)
left(120)
forward(200)
left(120)
forward(200)
return
# Test
# triangle()
# exitonclick()
##############################
## Question 2 ##
def carre():
color('green')
for i in range(4):
forward(200)
left(90)
return
# Test
# carre()
# exitonclick()
##############################
## Question 3 ##
def hexagone(longueur):
color('blue')
for i in range(6):
forward(longueur)
left(60)
return
# Test
# hexagone(100)
# exitonclick()
##############################
## Question 4 ##
def polygone(n,longueur):
color('purple')
angle = 360/n
for i in range(n):
forward(longueur)
left(angle)
return
# Test
# polygone(10,70)
# exitonclick()
# Test tout
up()
goto(-450,0)
down()
triangle()
up()
goto(-200,0)
setheading(0)
down()
carre()
up()
goto(100,0)
setheading(0)
down()
hexagone(100)
up()
goto(320,0)
setheading(0)
down()
polygone(8,70)
up()
exitonclick()