NSI

Commit 1a2362bd authored by Lesaint Cyprien's avatar Lesaint Cyprien

Upload New File

parent 04406112
def tri_selection(tab):
n = len(tab)
for i in range(n - 1):
min = i
for j in range(i + 1, n):
if tab[j] < tab[min]:
min = j
tab[i], tab[min] = tab[min], tab[i]
from random import randint
def plus_ou_moins():
nb_mystere = randint(1, 99)
nb_test = int(input("Proposez un nombre entre 1 et 99 : "))
compteur = 1
while nb_test != nb_mystere and compteur < 10:
compteur = compteur + 1
if nb_mystere > nb_test:
nb_test = int(input("Trop petit ! Testez encore : "))
else:
nb_test = int(input("Trop grand ! Testez encore : "))
compteur += 1
if nb_test == nb_mystere:
print("Bravo ! Le nombre était "nb_mystere)
print("Nombre d'essais :" compteur)
else:
print("Perdu ! Le nombre était" nb_mystere)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment