mirror of
https://github.com/BreizhHardware/py_A2.git
synced 2026-01-18 16:47:38 +01:00
Remove DS from past year
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
def checkIfPrimeNumber(n):
|
||||
if n % n == 0 & n % 1 == 0:
|
||||
for i in range(2, n):
|
||||
if n % i == 0:
|
||||
return False
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def circulaire(n):
|
||||
toTest = []
|
||||
toTest.append(n)
|
||||
for i in range(len(str(n)) - 1):
|
||||
toTest.append(int(str(toTest[i])[-1] + str(toTest[i])[:-1]))
|
||||
print(toTest)
|
||||
for number in toTest:
|
||||
if checkIfPrimeNumber(number) == False:
|
||||
return False
|
||||
return True
|
||||
|
||||
if __name__ == '__main__':
|
||||
print('719 est circulaire : ', circulaire(719))
|
||||
print('23 est circulaire : ', circulaire(23))
|
||||
print('6102 est circulaire : ', circulaire(6102))
|
||||
@@ -1,42 +0,0 @@
|
||||
class Personne:
|
||||
def __init__(self, name, age):
|
||||
self.__age = age
|
||||
self.__name = name
|
||||
|
||||
def get_nom(self):
|
||||
return self.__name
|
||||
|
||||
def get_age(self):
|
||||
return self.__age
|
||||
|
||||
def increment_age(self):
|
||||
self.__age = self.__age + 1
|
||||
|
||||
|
||||
class Eleve(Personne):
|
||||
def __init__(self, name, age, section):
|
||||
super().__init__(name, age)
|
||||
self.section = section
|
||||
|
||||
|
||||
class Prof(Personne):
|
||||
def __init__(self, name, age, matiere):
|
||||
super().__init__(name, age)
|
||||
self.matiere = matiere
|
||||
|
||||
|
||||
def calcule_moyenne_age(personnes):
|
||||
total = 0
|
||||
for personne in personnes:
|
||||
total += personne.get_age()
|
||||
return total / len(personnes)
|
||||
|
||||
if __name__ == '__main__':
|
||||
eleve1 = Eleve('eleve1', 19, 'CIR2')
|
||||
print(f"l'élève {eleve1.get_nom()} de la section {eleve1.section} a {eleve1.get_age()} ans")
|
||||
eleve1.increment_age()
|
||||
print(f"l'élève {eleve1.get_nom()} de la section {eleve1.section} a maintenant {eleve1.get_age()} ans")
|
||||
prof1 = Prof('prof1', 40, 'java')
|
||||
prof2 = Prof('prof2', 50, 'python')
|
||||
print(f"l'âge moyen des profeseurs est {calcule_moyenne_age((prof1, prof2))} ans")
|
||||
print(f"l'âge moyen des profeseurs et étudiants est {calcule_moyenne_age((prof1, prof2, eleve1)) : 0.2f} ans")
|
||||
@@ -1,38 +0,0 @@
|
||||
import cmath
|
||||
import turtle
|
||||
import time
|
||||
|
||||
turtle.speed('fastest')
|
||||
def get_racine(radius, number):
|
||||
out = []
|
||||
com = cmath.sqrt(radius ** 2 - (radius / 2) ** 2)
|
||||
for i in range(number):
|
||||
com = com * cmath.exp(2j * cmath.pi / number)
|
||||
out.append(com)
|
||||
return out
|
||||
|
||||
|
||||
def printminicircle(x, y, radius=3):
|
||||
turtle.up()
|
||||
turtle.goto(x, y)
|
||||
turtle.down()
|
||||
turtle.filling()
|
||||
turtle.fillcolor(0, 0, 0)
|
||||
turtle.begin_fill()
|
||||
turtle.circle(radius)
|
||||
turtle.end_fill()
|
||||
|
||||
|
||||
def draw():
|
||||
i = 1
|
||||
path = get_racine(100, 60)
|
||||
while i > -1:
|
||||
for point in path:
|
||||
printminicircle(point.real, point.imag)
|
||||
time.sleep(1)
|
||||
turtle.clear()
|
||||
i = i + 1
|
||||
|
||||
if __name__ == '__main__':
|
||||
draw()
|
||||
|
||||
Reference in New Issue
Block a user