Files
live-campus-mcs-p-2027.2/Semaine_04/Gauvain_BOICHE/main.py
2026-01-16 17:13:01 +01:00

45 lines
1.6 KiB
Python

from datetime import date, time, datetime, timedelta
from pprint import pprint
from exo_01 import persistance
from exo_02 import numeral_square
from exo_03 import gen_pyramid
from prog_or_obj import Service,\
ServeurPhysique,\
ServeurVirtuel,\
Technicien,\
Maintenance,\
Datacenter
# Exercice 1
print("\n----- Exercice [1] -----\n")
exo_1_test_list = [-7, 4, 39, 999]
for test in exo_1_test_list:
print(persistance(test))
# Exercice 2
print("\n----- Exercice [2] -----\n")
exo_2_test_list = [-7, 16, 942, 132189, 493193]
for test in exo_2_test_list:
print(numeral_square(test))
# Exercice 3
print("\n----- Exercice [3] -----\n")
exo_3_test_list = [-7, 0, 6, 12]
for test in exo_3_test_list:
pprint(gen_pyramid(test), width= 30)
# Exercice de Programmation Orientée Objet - Centre de données
today = date.today()
two_days_ago = date.today() - timedelta(days= 2)
five_days_ago = date.today() - timedelta(days= 5)
service_01 = Service("HTTP", 80, "TCP", True)
service_02 = Service("HTTPS", "443", "TCP", True)
service_03 = Service("PostGresql", 5432, "TCP", False)
service_04 = Service("Counter-Strike LAN", 36729, "UDP", False)
server_physical_01 = ServeurPhysique("Thorium", "10.10.19.94", "Debian 13", today, "HP version 4.2", 45, True)
server_physical_02 = ServeurPhysique("Iridium", "10.10.18.94", "Arch Linux 4", two_days_ago, "HP version 4.2", 37, True)
server_physical_03 = ServeurPhysique("Polonium", "10.10.17.94", "Apple Server mdr", five_days_ago, "HP version 3.3", 445, False)