Delete exercise 3.6.1 and exercise 3.6.2 Python files

This commit is contained in:
Tutur33
2023-12-18 21:09:31 +01:00
parent d1935079d4
commit 3d8d15b843
292 changed files with 11955 additions and 32 deletions
@@ -0,0 +1,19 @@
chaine = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
from random import randint, choice
def password(n:int) -> str:
r = ''
for i in range(n):
r += chaine[randint(0, len(chaine))]
return r
print(password(10))
def password2(n:int) -> str:
r = ''
for i in range(n):
r += choice(chaine)
return r
print(password2(10))
@@ -0,0 +1,8 @@
from random import choice
ListeCarte = ['2s','2h','2d','2c','3s','3h','3d','3c','4s','4h','4d','4c','5s','5h','5d','5c', '6s','6h','6d','6c','7s','7h','7d','7c','8s','8h','8d','8c','9s','9h','9d','9c', 'Ts','Th','Td','Tc','Js','Jh','Jd','Jc','Qs','Qh','Qd','Qc','Ks','Kh','Kd','Kc','As','Ah','Ad','Ac']
def tiragecarte():
return choice(ListeCarte)
print(tiragecarte())
@@ -0,0 +1,12 @@
from random import choice
ListeCarte = ['2s','2h','2d','2c','3s','3h','3d','3c','4s','4h','4d','4c','5s','5h','5d','5c', '6s','6h','6d','6c','7s','7h','7d','7c','8s','8h','8d','8c','9s','9h','9d','9c', 'Ts','Th','Td','Tc','Js','Jh','Jd','Jc','Qs','Qh','Qd','Qc','Ks','Kh','Kd','Kc','As','Ah','Ad','Ac']
def tiragecarte(n:int):
u = []
for i in range(n):
u.append(choice(ListeCarte))
return u
print(tiragecarte(4))
@@ -0,0 +1,9 @@
from random import sample
def euromillions():
return sample(liste,5) + sample(etoiles,2)
liste = [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]
etoiles = [1,2,3,4,5,6,7,8,9,10,11]
print(euromillions())
@@ -0,0 +1,34 @@
def f(x):
return 27*x**3 -27*x**2-18*x +8
def dicotomi(x:int, t:list) -> int:
r = -1
g = 0
d = len(t) - 1
while r == -1 and g <= d:
m = (g + d)//2
if t[m] == x:
r = m
elif x > t[m]:
g = m + 1
else:
d = m - 1
return r
print("Recherche d'un zéro dans l'intervalle [a,b]")
a = int(input("a? "))
b = int(input("b? ")) + 1
p = eval(input("Précision ? "))
u = []
for i in range(a, b, p):
u.append(i)
print(u)
print(dicotomi(f(0),u))
m = (a - b)/2