This commit is contained in:
smayzy committed 2026-10-04 11:11:18 +02:00
1 parent 6361168409
commit bfac007c85
9 files changed
+118

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
a = int(input("Val a : "))
b = int(input("Val b : "))
avg = (a + b) / 2
if (a > b) :
max = a
else :
max = b
print("avg = ", avg)
print("max = ", max)
+12
View File
@@ -0,0 +1,12 @@
def from_base(digits, base):
power = 1
number = 0
for digit in reversed(digits):
number += power * digit
power *= base
return number
digits = [int(input("digit_a : ")), int(input("digit_b : ")), int(input("digit_c : ")), int(input("digit_c : "))]
base = int(input("base : "))
print(from_base(digits, base))
+11
View File
@@ -0,0 +1,11 @@
def to_base(number, base):
digits = []
while number:
digits.append(number % base)
number //= base
return list(reversed(digits))
number = int(input("number : "))
base = int(input("base : "))
print(to_base(number, base))
+13
View File
@@ -0,0 +1,13 @@
from math import sqrt
a = int(input("a : "))
b = int(input("b : "))
c = int(input("c : "))
delta = (b ** 2) - (4 * a * c)
v1 = (-1 * b - sqrt(delta)) / (2 * a)
v2 = (-1 * b + sqrt(delta)) / (2 * a)
print("v1 : ", v1)
print("v2 : ", v2)
+10
View File
@@ -0,0 +1,10 @@
import math
Nb = int(input("Quelle décimale voulez-vous extraire ? "))
Decimal = math.pi - math.trunc(math.pi)
Decale = Decimal * 10**(Nb-1)
Decimabis = Decale - math.trunc(Decale)
Madecimale = math.trunc(Decimabis*10)
print("La ",Nb,"ième décimale de Pi est :", Madecimale)
+20
View File
@@ -0,0 +1,20 @@
from math import sqrt
a = int(input("a : "))
b = int(input("b : "))
c = int(input("c : "))
delta = (( b - a ) ** 2) - (4 * (c - 3))
if delta < 0 :
print("pas d'inté")
elif delta == 0 :
x = (-1 * (b - a)) / 2
y = a * x + 3
print("1 inté x :", x, " y :", y)
else :
x1 = (-1 * (b - a) - sqrt(delta)) / 2
x2 = (-1 * (b - a) + sqrt(delta)) / 2
y1 = (a * x1) + 3
y2 = (a * x2) + 3
print("2 inté : x1 :", x1, " y1 :", y1, " x2 :", x2, " y2 :", y2)