1
0
Fork 0

Initial commit.

This commit is contained in:
Yohan Boujon 2020-01-21 11:29:18 +01:00
commit 79e5d11518
22 changed files with 284 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
**/__pycache__

41
année.py Executable file
View file

@ -0,0 +1,41 @@
n = 32
for x in range (1,13):
for jour in range(1,n):
print(jour, end="")
if x == 1 :
print(" janvier")
n=29
if x == 2 :
print(" février")
n=32
if x == 3 :
print(" mars")
n=31
if x == 4 :
print(" avril")
n=32
if x == 5 :
print(" mai")
n=31
if x == 6 :
print(" juin")
n=32
if x == 7 :
print(" juillet")
n=32
if x == 8 :
print(" août")
n=31
if x == 9 :
print(" septembre")
n=32
if x == 10 :
print(" octobre")
n=31
if x == 11 :
print(" novembre")
n=32
if x == 12 :
print(" décembre")

29
battleship.py Executable file
View file

@ -0,0 +1,29 @@
import random
julyan=0
start=0
a = random.randint(0,16)
b = random.randint(0,16)
while julyan == 0:
if start == 0:
print("A toi de jouer - selectionnez deux valeurs")
if start == 1:
print("Réessaye !")
x = int(input("X = "))
y = int(input("Y = "))
if x == a and y == b:
print ("*boum*")
start=1
julyan=1
else :
if x == a :
print ("Première coordonnée correcte !")
start=1
if y == b :
print ("Deuxième coordonée correcte !")
start=1
else :
print ("*plouf*")
start=1

16
defdivi.py Executable file
View file

@ -0,0 +1,16 @@
def Division(a,b) :
if b == 0:
print("La division par 0 est impossible !")
s = 0
elif b != 0:
s = a/b
return s
a = float(input("[a]/b = "))
b = float(input("a/[b] = "))
div = Division(a,b)
if b != 0:
print("La division des nombres est :"+str(div))

18
divisible.py Executable file
View file

@ -0,0 +1,18 @@
print("Entrez une valeur X pour savoir si elle est divisible par 2,5 et 7")
x = int(input("X = "))
if x%2 == 0:
print("X est divisible par 2")
else:
print("X n'est pas divisible par 2")
if x%3 == 0:
print("X est divisible par 3")
else:
print("X n'est pas divisible par 3")
if x%5 == 0:
print("X est divisible par 5")
else:
print("X n'est pas divisible par 5")
if x%7 == 0:
print("X est divisible par 7")
else x%7 == 1:
print("X n'est pas divisible par 7")

10
exercicevacances.py Executable file
View file

@ -0,0 +1,10 @@
import monmodule
a = float(input("[a]/b = "))
b = float(input("a/[b] = "))
monmodule.Division("a")
monmodule.Division("b")
if b != 0:
print("La division des nombres est :"+str(div))

12
math.py Executable file
View file

@ -0,0 +1,12 @@
import math
t = float(input("t ="))
if t <= 1/2 :
gt = 20*t
elif t >= 2/3 :
gt = ((7/6)*10)/2+10*t
elif t > 1 :
gt = 0
else:
gt = ((t+1/2)*10)/2+10*t
print(gt)

3
mois.py Executable file
View file

@ -0,0 +1,3 @@
for jour in range(1,32):
print(jour, end="")
print(" janvier")

7
monmodule.py Executable file
View file

@ -0,0 +1,7 @@
def Division(a,b) :
if b == 0:
print("La division par 0 est impossible !")
s = 0
elif b != 0:
s = a/b
return s

20
racine.py Executable file
View file

@ -0,0 +1,20 @@
import os
import math
print("Mettez vos valeurs a,b et c")
a = eval(input("a [x²] = "))
b = eval(input("b [x] = "))
c = eval(input("c = "))
delta = (b**2)-(4*a*c)
if delta == 0 :
x1 = -(b/2*a)
print ("x = "+str(x1))
elif delta < 0 :
print("Aucun racine.")
else :
x1 = (-b-math.sqrt(delta))/(2*a)
x2 = (-b+math.sqrt(delta))/(2*a)
print ("La première valeur est "+str(x1))
print ("Le deuxième valeur est "+str(x2))
os.system('pause')

7
tax.py Executable file
View file

@ -0,0 +1,7 @@
import os
print("Quel est le prix hors taxes ?")
ht = float(input("HT = "))
tva = float(input("TVA = "))
ttc = ht + ht * tva / 100.0
print ("Le prix toutes taxes comprises est "+str(ttc))
os.system('pause')

7
temp.py Executable file
View file

@ -0,0 +1,7 @@
moyenne = 0
jour = 0
for jour in range (1,8):
temperature = int(input("Température = "))
moyenne = moyenne + température
print

3
teoupala.py Executable file
View file

@ -0,0 +1,3 @@
for jour in range(1,32):
print(jour, end="")
print(" janvier")

15
turtle10.py Executable file
View file

@ -0,0 +1,15 @@
from turtle import *
x=100
g=200
h=90
speed(10)
color("white")
goto(-1/2*x,-1/2*x)
color("black")
for i in range (100):
for i in range (4):
forward(g)
left(h)
left(10)
g=g-5
mainloop()

14
turtle2.py Executable file
View file

@ -0,0 +1,14 @@
from turtle import *
c = float(input("Carré = "))
color("white")
goto(-1/2*c,-1/2*c)
color("black")
for i in range (4):
forward(c)
left(90)
color("white")
goto(1/10000*c,1/128*c)
color("black")
circle(4/10*c)
mainloop()

11
turtle3.py Executable file
View file

@ -0,0 +1,11 @@
from turtle import *
x=200
bgcolor("yellow")
color("yellow")
goto(-1/2*x,-1/2*x)
color("red")
for i in range (50):
forward(x)
left(90)
x=x-4
mainloop()

9
turtle4.py Executable file
View file

@ -0,0 +1,9 @@
from turtle import *
x=100
color("white")
goto(-1/2*x,-1/2*x)
color("black")
for i in range (5):
left(144)
forward(x)
mainloop()

17
turtle5.py Executable file
View file

@ -0,0 +1,17 @@
from turtle import *
x=100
color("white")
goto(-1/2*x,-1/2*x)
color("black")
for i in range (4):
for i in range (6):
forward(20)
right(90)
forward(20)
left(90)
forward(20)
left(90)
forward(20)
right(90)
left(90)
mainloop()

8
turtle6.py Executable file
View file

@ -0,0 +1,8 @@
from turtle import *
x=100
color("white")
goto(-1/2*x,-1/2*x)
color("black")
for i in range (10):
circle(50)
left(75)

8
turtle7.py Executable file
View file

@ -0,0 +1,8 @@
from turtle import *
x=100
color("white")
goto(-1/2*x,-1/2*x)
color("black")
for i in range (36):
circle(80)
left(10)

14
turtle8.py Executable file
View file

@ -0,0 +1,14 @@
from turtle import *
x=100
g=15
h=90
speed(10)
color("white")
goto(-1/2*x,-1/2*x)
color("black")
for i in range (150):
forward(g)
left(h)
h=h-0.01
g=g+1
mainloop()

14
turtle9.py Executable file
View file

@ -0,0 +1,14 @@
from turtle import *
x=100
g=200
speed(10)
color("white")
goto(-1/2*x,-1/2*x)
color("black")
for i in range (42):
for i in range (4):
forward(g)
left(90)
left(10)
g=g-5
mainloop()