commit 79e5d1151880b774c55593b3c773d8afc96b7e53 Author: Yohan Boujon Date: Tue Jan 21 11:29:18 2020 +0100 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5e4f15 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/__pycache__ \ No newline at end of file diff --git a/année.py b/année.py new file mode 100755 index 0000000..e1762ba --- /dev/null +++ b/année.py @@ -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") + diff --git a/battleship.py b/battleship.py new file mode 100755 index 0000000..6c6051b --- /dev/null +++ b/battleship.py @@ -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 \ No newline at end of file diff --git a/defdivi.py b/defdivi.py new file mode 100755 index 0000000..09a8184 --- /dev/null +++ b/defdivi.py @@ -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)) + diff --git a/divisible.py b/divisible.py new file mode 100755 index 0000000..038700c --- /dev/null +++ b/divisible.py @@ -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") \ No newline at end of file diff --git a/exercicevacances.py b/exercicevacances.py new file mode 100755 index 0000000..d301daa --- /dev/null +++ b/exercicevacances.py @@ -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)) \ No newline at end of file diff --git a/math.py b/math.py new file mode 100755 index 0000000..59be36a --- /dev/null +++ b/math.py @@ -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) \ No newline at end of file diff --git a/mois.py b/mois.py new file mode 100755 index 0000000..7571aaa --- /dev/null +++ b/mois.py @@ -0,0 +1,3 @@ +for jour in range(1,32): + print(jour, end="") + print(" janvier") \ No newline at end of file diff --git a/monmodule.py b/monmodule.py new file mode 100755 index 0000000..55a1103 --- /dev/null +++ b/monmodule.py @@ -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 \ No newline at end of file diff --git a/racine.py b/racine.py new file mode 100755 index 0000000..b13cdeb --- /dev/null +++ b/racine.py @@ -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') diff --git a/tax.py b/tax.py new file mode 100755 index 0000000..89760fa --- /dev/null +++ b/tax.py @@ -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') \ No newline at end of file diff --git a/temp.py b/temp.py new file mode 100755 index 0000000..c05d403 --- /dev/null +++ b/temp.py @@ -0,0 +1,7 @@ +moyenne = 0 +jour = 0 + +for jour in range (1,8): + temperature = int(input("Température = ")) + moyenne = moyenne + température +print \ No newline at end of file diff --git a/teoupala.py b/teoupala.py new file mode 100755 index 0000000..7571aaa --- /dev/null +++ b/teoupala.py @@ -0,0 +1,3 @@ +for jour in range(1,32): + print(jour, end="") + print(" janvier") \ No newline at end of file diff --git a/turtle10.py b/turtle10.py new file mode 100755 index 0000000..f3faec6 --- /dev/null +++ b/turtle10.py @@ -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() \ No newline at end of file diff --git a/turtle2.py b/turtle2.py new file mode 100755 index 0000000..62e17d0 --- /dev/null +++ b/turtle2.py @@ -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() diff --git a/turtle3.py b/turtle3.py new file mode 100755 index 0000000..fa4541b --- /dev/null +++ b/turtle3.py @@ -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() \ No newline at end of file diff --git a/turtle4.py b/turtle4.py new file mode 100755 index 0000000..b0d128a --- /dev/null +++ b/turtle4.py @@ -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() \ No newline at end of file diff --git a/turtle5.py b/turtle5.py new file mode 100755 index 0000000..7f44760 --- /dev/null +++ b/turtle5.py @@ -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() \ No newline at end of file diff --git a/turtle6.py b/turtle6.py new file mode 100755 index 0000000..5dfc372 --- /dev/null +++ b/turtle6.py @@ -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) \ No newline at end of file diff --git a/turtle7.py b/turtle7.py new file mode 100755 index 0000000..5276e9f --- /dev/null +++ b/turtle7.py @@ -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) \ No newline at end of file diff --git a/turtle8.py b/turtle8.py new file mode 100755 index 0000000..8e55a5a --- /dev/null +++ b/turtle8.py @@ -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() \ No newline at end of file diff --git a/turtle9.py b/turtle9.py new file mode 100755 index 0000000..0b59527 --- /dev/null +++ b/turtle9.py @@ -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() \ No newline at end of file