Ep Pratique : Interrogation du 4 janvier 202322-NSI-08Télécharger Python def insere(a, tab): l = list(tab) #l contient les mêmes éléments que tab l.append(a) i = … while a < … and i >= 0: l[i+1] = … l[i] = a i = … return l CORRECTION-SUJET-NSI-n°08Téléchargersujet-15-correctionTélécharger22-NSI-15Télécharger Python def binaire(a): bin_a = str(…) a = a // 2 while a … : bin_a = …(a%2) + … a = … return bin_a 22-NSI-19Télécharger Python def binaire(a): bin_a = str(…) a = a // 2 while a … : bin_a = …(a%2) + … a = … return bin_a correction-sujet-19Télécharger22-NSI-32Télécharger Python class AdresseIP: def __init__(self, adresse): self.adresse = … def liste_octet(self): """renvoie une liste de nombres entiers, la liste des octets de l'adresse IP""" return [int(i) for i in self.adresse.split(".")] def est_reservee(self): """renvoie True si l'adresse IP est une adresse réservée, False sinon""" return … or … def adresse_suivante(self): """renvoie un objet de AdresseIP avec l'adresse IP qui suit l’adresse self si elle existe et False sinon""" if … < 254: octet_nouveau = … + … return AdresseIP('192.168.0.' + …) else: return False Correction-NSI-32Télécharger22-NSI-36Télécharger Python from math import sqrt # import de la fonction racine carree def distance(point1, point2): """ Calcule et renvoie la distance entre deux points. """ return sqrt((…)**2 + (…)**2) assert distance((1, 0), (5, 3)) == 5.0, "erreur de calcul" def plus_courte_distance(tab, depart): """ Renvoie le point du tableau tab se trouvant a la plus courte distance du point depart.""" point = tab[0] min_dist = … for i in range (1, …): if distance(tab[i], depart)…: point = … min_dist = … return point assert plus_courte_distance([(7, 9), (2, 5), (5, 2)], (0, 0)) == (2, 5), "erreur" 22-NSI-39Télécharger Python coeur = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \ [0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0], \ [0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0], \ [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], \ [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], \ [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], \ [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], \ [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], \ [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], \ [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0], \ [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], \ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] def affiche(dessin): ''' affichage d'une grille : les 1 sont repreente par des "*" , les 0 par deux espaces " " ''' for ligne in dessin: for col in ligne: if col == 1: print(" *",end="") else: print(" ",end="") print() def zoomListe(liste_depart,k): '''renvoie une liste contenant k fois chaque element de liste_depart''' liste_zoom = … for elt in … : for i in range(k): … return liste_zoom def zoomDessin(grille,k): '''renvoie une grille ou les lignes sont zoomees k fois ET repetees k fois''' grille_zoom=[] for elt in grille: liste_zoom = … for i in range(k): … .append(…) return grille_zoom Epreuve-Pratique-SUJET-39Télécharger
GILLOT Yann décembre 15, 2022 à 1:38 pm Lien Sujet 08 (Lecture Uniquement) https://docs.google.com/document/d/150yrnCMXW6nMsf_-BMOoBqIrhMPQwyVo5Xh3vCnYaa8/edit?usp=sharing Répondre
Maxime N. Leo.L décembre 15, 2022 à 1:50 pm https://drive.google.com/file/d/1jA_Wy2SFKqM1SjV0k9FQE-tIHldUxRcD/view?usp=share_link Répondre
Lien Sujet 08 (Lecture Uniquement)
https://docs.google.com/document/d/150yrnCMXW6nMsf_-BMOoBqIrhMPQwyVo5Xh3vCnYaa8/edit?usp=sharing
https://drive.google.com/file/d/1jA_Wy2SFKqM1SjV0k9FQE-tIHldUxRcD/view?usp=share_link