This commit is contained in:
divingeek 2025-08-26 18:38:28 +02:00
parent 3ad9ff1140
commit eb3c7313c5
199 changed files with 10833 additions and 0 deletions

4
C1/vs/q10_12.py Normal file
View file

@ -0,0 +1,4 @@
if x < 4:
x = x + 3
else:
x = x - 3

3
C1/vs/q11_13.py Normal file
View file

@ -0,0 +1,3 @@
n = 1
while n != 20:
n = n + 2

3
C1/vs/q11_3.py Normal file
View file

@ -0,0 +1,3 @@
while (a < 20) or (b > 50):
......
......

3
C1/vs/q12_14.py Normal file
View file

@ -0,0 +1,3 @@
floor(x)
Return the floor of x as an Integral. This is the largest in
teger <= x.

3
C1/vs/q12_4.py Normal file
View file

@ -0,0 +1,3 @@
x = 1
for i in range(10):
x = x * 2

5
C1/vs/q13_15.py Normal file
View file

@ -0,0 +1,5 @@
def comparaison(a,b):
if a < b:
return a
else:
return b

4
C1/vs/q15_16.py Normal file
View file

@ -0,0 +1,4 @@
m = L[0]
for j in range(len(L)):
if m < L[j]:
m = L[j]

7
C1/vs/q16_17.py Normal file
View file

@ -0,0 +1,7 @@
a = 4
b = 4
c = 4
while a < 5:
a = a - 1
b = b + 1
c = c * b

6
C1/vs/q18_22.py Normal file
View file

@ -0,0 +1,6 @@
def moyenne(notes):
somme = 0
for cpt in range(len(notes)):
....
m = somme/len(notes)
return m

5
C1/vs/q19_23.py Normal file
View file

@ -0,0 +1,5 @@
def factorielle(n):
f = 1
.........
f = f * i
return f

5
C1/vs/q1_5.py Normal file
View file

@ -0,0 +1,5 @@
def ajoute(n,p):
somme = 0
for i in range(.........): # ligne à modifier
somme = somme + i
return somme

8
C1/vs/q20_24.py Normal file
View file

@ -0,0 +1,8 @@
def f(t):
n = len(t)
for i in range(n-1):
if t[i] > t[i+1]:
t[i],t[i+1] = t[i+1],t[i]
L = [4, 8, -7, 0, 1]
f(L)

4
C1/vs/q21_25.py Normal file
View file

@ -0,0 +1,4 @@
from math import sqrt
def racine_du_double(x):
return sqrt(2*x)

9
C1/vs/q22_26.py Normal file
View file

@ -0,0 +1,9 @@
def essai():
a = 2
b = 3
c = 4
return a
return b
return c
t = essai()

1
C1/vs/q23_27.py Normal file
View file

@ -0,0 +1 @@
resultat = [0] * 7

5
C1/vs/q24_28.py Normal file
View file

@ -0,0 +1,5 @@
def somme(T, a, b):
S = 0
for i in range(a, b+1) :
S = S + T[i]
return S

6
C1/vs/q25_29.py Normal file
View file

@ -0,0 +1,6 @@
def maximum(L):
m = L[0]
for i in range(1,len(L)):
if .........:
m = L[i]
return m

1
C1/vs/q26_30.py Normal file
View file

@ -0,0 +1 @@
import os

5
C1/vs/q27_31.py Normal file
View file

@ -0,0 +1,5 @@
def f(x,y,z):
if x+y == z:
return True
else:
return False

10
C1/vs/q28_32.py Normal file
View file

@ -0,0 +1,10 @@
def maFonction(c):
if c <= 10:
p = 12
if c <= 18:
p = 15
if c <= 40:
p = 19
else:
p = 20
return p

6
C1/vs/q29_33.py Normal file
View file

@ -0,0 +1,6 @@
def f(n):
c = 0
while n > 0:
c = c + 1
n = n // 2
return c

5
C1/vs/q30_34.py Normal file
View file

@ -0,0 +1,5 @@
def puissance (x,y):
p = x
for i in range (y - 1):
p = p * x
return p

3
C1/vs/q31_35.py Normal file
View file

@ -0,0 +1,3 @@
tableau1 = [1, 2, 3]
tableau2 = [4, 5, 6]
long = len(tableau1 + tableau2)

3
C1/vs/q32_36.py Normal file
View file

@ -0,0 +1,3 @@
a = a - b
b = a + b
a = ......

7
C1/vs/q33_37.py Normal file
View file

@ -0,0 +1,7 @@
def f(t):
n = len(t)
for i in range(n-1):
for j in range(i+1,n):
if t[i] == t[j]:
return True
return False

6
C1/vs/q34_38.py Normal file
View file

@ -0,0 +1,6 @@
def maximum(tableau):
tmp = tableau[0]
for i in range(......): # à compléter
if tableau[i] > tmp:
tmp = tableau[i]
return tmp

6
C1/vs/q35_39.py Normal file
View file

@ -0,0 +1,6 @@
a = 3
b = 6
if a > 5 or b != 3:
b = 4
else:
b = 2

6
C1/vs/q36_40.py Normal file
View file

@ -0,0 +1,6 @@
a = 2
b = 5
if a > 8:
b = 10
elif a > 6:
b = 3

3
C1/vs/q38_41.py Normal file
View file

@ -0,0 +1,3 @@
i = 0
while 2**i < A :
i = i + 1

6
C1/vs/q39_42.py Normal file
View file

@ -0,0 +1,6 @@
i = 0
while (i < 10) {
alert(i)
i = i + 1
}
alert("Fin")

4
C1/vs/q3_1.py Normal file
View file

@ -0,0 +1,4 @@
a = 2
b = 3
c = a ** b
d = c % b

5
C1/vs/q3_6.py Normal file
View file

@ -0,0 +1,5 @@
n = 6
s = 0
while n >= 0:
s = s + n
n = n -1

3
C1/vs/q40_43.py Normal file
View file

@ -0,0 +1,3 @@
def maxi(x,y) :
m = (x-y+abs(x+y))/2
return m

6
C1/vs/q41_44.py Normal file
View file

@ -0,0 +1,6 @@
def fib(n):
t = [0] * n
t[1] = 1
for i in range(2,n):
t[i] = t[i-1] + t[i-2]
return t

9
C1/vs/q42_45.py Normal file
View file

@ -0,0 +1,9 @@
a = 10
if a < 5:
a = 20
elif a < 100:
a = 500
elif a < 1000:
a = 1
else:
a = 0

5
C1/vs/q43_46.py Normal file
View file

@ -0,0 +1,5 @@
def puiss(y,x):
res = y
for i in range(x):
res = res*y
return res

3
C1/vs/q45_47.py Normal file
View file

@ -0,0 +1,3 @@
n = 1
for i in range(4):
n = n + 2

5
C1/vs/q46_48.py Normal file
View file

@ -0,0 +1,5 @@
def rey(n):
i = 0
while i <= n:
i = 2*i
return i

3
C1/vs/q47_49.py Normal file
View file

@ -0,0 +1,3 @@
L = []
for i in range(1,11,2)
L.append(5*i)

5
C1/vs/q47_50.py Normal file
View file

@ -0,0 +1,5 @@
L = []
# ligne 1 .......
while i < 11:
L.append(5*i)
# ligne 2 .......

5
C1/vs/q48_51.py Normal file
View file

@ -0,0 +1,5 @@
def cube(a):
a = a*a*a
return a
a = 2
b = cube(a)

7
C1/vs/q49_52.py Normal file
View file

@ -0,0 +1,7 @@
def cube(L):
for i in range(len(L)):
L[i] = L[i] * L[i] * L[i]
return L
L = [2, 5]
b = cube(L)

7
C1/vs/q50_53.py Normal file
View file

@ -0,0 +1,7 @@
def capital_double (capital, interet):
montant = capital
n = 0
while montant <= 2 * capital:
montant = montant + interet
n = n + 1
return n

7
C1/vs/q51_54.py Normal file
View file

@ -0,0 +1,7 @@
def f(x):
y = 2*x + 1
return y
def calcul(x):
y = x - 1
return f(y)

6
C1/vs/q52_55.py Normal file
View file

@ -0,0 +1,6 @@
x = 4
while x > 0:
y = 1
while y < x:
y = y + 1
x = x - 1

10
C1/vs/q54_56.py Normal file
View file

@ -0,0 +1,10 @@
def calculPourcentage (prix,reduction):
assert reduction >= 0, 'la réduction doit être un nombre p
ositif'
assert reduction < 100, 'la réduction doit être inférieure
à 100'
assert prix > 0, 'le prix doit être un nombre strictement
positif'
remise = (reduction*prix)/100
prix_remise = prix - remise
return prix_remise

6
C1/vs/q55_57.py Normal file
View file

@ -0,0 +1,6 @@
def minimum(L):
mini = 0
for e in L:
if e < mini:
mini = e
return mini

5
C1/vs/q56_58.py Normal file
View file

@ -0,0 +1,5 @@
def somme(L):
s = L[0]
for i in range(len(L)):
s = s + L[i]
return s

6
C1/vs/q57_59.py Normal file
View file

@ -0,0 +1,6 @@
def f(L,m):
R = []
for i in range(len(L)):
if L[i] > m:
R.append(L[i])
return R

4
C1/vs/q58_60.py Normal file
View file

@ -0,0 +1,4 @@
a = 11
for i in range(3):
a = a * 2
a = a - 10

3
C1/vs/q59_61.py Normal file
View file

@ -0,0 +1,3 @@
a,b = 10,3
if a < 10:
a,b = a+2,b+a

6
C1/vs/q5_2.py Normal file
View file

@ -0,0 +1,6 @@
if a==b:
c = True
elif a > b+10:
c = True
else:
c = False

4
C1/vs/q5_7.py Normal file
View file

@ -0,0 +1,4 @@
def f(a,b):
assert b!=0,'le deuxième argument est nul'
result = a/b
return result

6
C1/vs/q61_62.py Normal file
View file

@ -0,0 +1,6 @@
def maximum(L):
m = L[0]
for i in range(1,len(L)):
..............
..............
return m

7
C1/vs/q62_67.py Normal file
View file

@ -0,0 +1,7 @@
def maxi(L):
dernier_indice = len(L) - 1
valeur_max = L[0]
for i in range(1,dernier_indice):
if L[i] > valeur_max:
valeur_max = liste[i]
return valeur_max

4
C1/vs/q63_68.py Normal file
View file

@ -0,0 +1,4 @@
import math
def aireDisque(R):
return math.pi * R**2

7
C1/vs/q64_73.py Normal file
View file

@ -0,0 +1,7 @@
def f(a,m):
i = 1
n = 0
while n <= m:
i = i * a
n = n + 1
return i

5
C1/vs/q6_8.py Normal file
View file

@ -0,0 +1,5 @@
def f(x,y):
x = x + y
y = x - y
x = x - y
return (x,y)

6
C1/vs/q7_9.py Normal file
View file

@ -0,0 +1,6 @@
def mystere(T):
s = 0
for k in T:
if k % 2 == 0:
s = s+k
return s

8
C1/vs/q8_10.py Normal file
View file

@ -0,0 +1,8 @@
def calcul(a,b):
a = a + 2
b = b + 5
c = a + b
return c
a,b = 3,5
calcul(a,b)

6
C1/vs/q9_11.py Normal file
View file

@ -0,0 +1,6 @@
def ranger(a, b, c):
if a > b :
a, b = b, a
if b > c:
b, c = c, b
return a, b, c

7
C1/vs/r17_a.py Normal file
View file

@ -0,0 +1,7 @@
def factorielle(n):
i = 0
fact = 1
while i <= n:
fact = fact * i
i = i + 1
return fact

7
C1/vs/r17_b.py Normal file
View file

@ -0,0 +1,7 @@
def factorielle(n):
i = 1
fact = 1
while i < n:
fact = fact * i
i = i + 1
return fact

7
C1/vs/r17_c.py Normal file
View file

@ -0,0 +1,7 @@
def factorielle(n):
i = 0
fact = 1
while i < n:
i = i + 1
fact = fact * i
return fact

7
C1/vs/r17_d.py Normal file
View file

@ -0,0 +1,7 @@
def factorielle(n):
i = 0
fact = 1
while i <= n:
i = i + 1
fact = fact * i
return fact

2
C1/vs/r61_a.py Normal file
View file

@ -0,0 +1,2 @@
if m < L[i]:
L[i] = m

2
C1/vs/r61_b.py Normal file
View file

@ -0,0 +1,2 @@
if L[i-1] < L[i]:
m = L[i]

2
C1/vs/r61_c.py Normal file
View file

@ -0,0 +1,2 @@
if L[i] < L[0]:
L[i],L[0] = L[0],L[i]

2
C1/vs/r61_d.py Normal file
View file

@ -0,0 +1,2 @@
if L[i] > m:
m = L[i]

2
C1/vs/r63_a.py Normal file
View file

@ -0,0 +1,2 @@
import GeomPlan
GeomPlan.aireDisque(8)

2
C1/vs/r63_b.py Normal file
View file

@ -0,0 +1,2 @@
import GeomPlan
aireDisque(8)

2
C1/vs/r63_c.py Normal file
View file

@ -0,0 +1,2 @@
from GeomPlan import *
aireDisque(8)

2
C1/vs/r63_d.py Normal file
View file

@ -0,0 +1,2 @@
from GeomPlan import aireDisque
aireDisque(8)