Python Exercices
Python Exercices
n = 2
sucre_vanille = 1*n//4
chocolats_noir = 100*n//4
oeufs = 3*n//4
import turtle
turtle.color('black')
turtle.begin_fill()
turtle.forward(100)
turtle.right(120)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(120)
turtle.forward(100)
turtle.end_fill()
turtle.color('red')
turtle.begin_fill()
turtle.left(60)
turtle.forward(100)
turtle.right(120)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(120)
turtle.forward(100)
turtle.end_fill()
turtle.color('green')
turtle.begin_fill()
turtle.right(60)
turtle.forward(100)
turtle.left(120)
turtle.forward(100)
turtle.left(60)
turtle.forward(100)
turtle.end_fill()
import turtle
turtle.color('black')
turtle.begin_fill()
turtle.forward(100)
turtle.right(120)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(120)
turtle.forward(100)
turtle.end_fill()
turtle.color('red')
turtle.begin_fill()
turtle.left(60)
turtle.forward(100)
turtle.right(120)
turtle.forward(100)
turtle.right(60)
turtle.forward(100)
turtle.right(120)
turtle.forward(100)
turtle.end_fill()
turtle.color('green')
turtle.begin_fill()
turtle.right(60)
turtle.forward(100)
turtle.left(120)
turtle.forward(100)
turtle.left(60)
turtle.forward(100)
turtle.end_fill()
import math as m
import turtle as t
t.color("blue")
t.begin_fill()
t.goto(100,0)
t.goto(m.cos(m.pi/3)*100,m.sin(m.pi/3)*100)
t.goto(m.cos(2*m.pi/3)*100,m.sin(2*m.pi/3)*100)
t.goto(0,0)
t.end_fill()
t.color("black")
t.begin_fill()
t.goto(m.cos(2*m.pi/-3)*100,m.sin(2*m.pi/-3)*100)
t.goto(m.cos(m.pi/-3)*100,m.sin(m.pi/-3)*100)
t.goto(100,0)
t.goto(0,0)
t.end_fill()
t.color("red")
t.begin_fill()
t.goto(m.cos(2*m.pi/3)*100,m.sin(2*m.pi/3)*100)
t.goto(-100,0)
t.goto(m.cos(2*m.pi/3)*100,-m.sin(2*m.pi/3)*100)
t.end_fill()
4] EXERCICE : 2.4
import math as m
a = (-m.cos(m.pi)*n,0.0)
b = (m.cos(m.pi/3)*n,m.sin(m.pi/3)*n)
c = (m.cos(2*m.pi/3)*n,m.sin(2*m.pi/3)*n)
d = (m.cos(3*m.pi/3)*n,m.sin(3*m.pi/3)*n)
e = (m.cos(4*m.pi/3)*n,m.sin(4*m.pi/3)*n)
f = (m.cos(5*m.pi/3)*n,m.sin(5*m.pi/3)*n)
print(a)
print(b)
print(c)
print(d)
print(e)
print(f)
import math as m
n = float(input())
a = (-m.cos(m.pi)*n,0.0)
b = (m.cos(m.pi/3)*n,m.sin(m.pi/3)*n)
c = (m.cos(2*m.pi/3)*n,m.sin(2*m.pi/3)*n)
d = (m.cos(3*m.pi/3)*n,m.sin(3*m.pi/3)*n)
e = (m.cos(4*m.pi/3)*n,m.sin(4*m.pi/3)*n)
f = (m.cos(5*m.pi/3)*n,m.sin(5*m.pi/3)*n)
coordonnee = [a,b,c,d,e,f]
5] EXERCICE : 2.5
x = int(input())
y = int(input())
z = float(input())
t = float(input())
a = x - y
b = x + z
c = z + t
d = x * z
e = x / 2
f = x / (y+1)
g = (x+y)*z / (4*x)
h = x ** (-1/2)
liste = [a,b,c,d,e,f,g,h]
6] EXERCICE : 2.