

Étudies grâce aux nombreuses ressources disponibles sur Docsity
Gagnz des points en aidant d'autres étudiants ou achete-les avec un plan Premium
Cette page n'est pas visible dans l'aperçu
Ne manques pas les parties importantes!


def algoMystere(a, b): a = a * 2 b = b + 1 max = (a*b) // 2 i = 0 while i < max: c = a + b a = a - 1 b = b + a i = i + 1
def autreMystere(a, b): for i in range(a): chaine = "" for j in range(i): chaine = str(j) + chaine print(chaine)
def tableMultFor(m, a, b): ''' :entrée: :sortie: :pré-conditions: :post-conditions: ''' for mult in range(a, b): print(str(m) + "" + str(mult) + "=" + str(mmult)) def tableMultWhile(m, a, b): ''' :entrée: :sortie: :pré-conditions: :post-conditions: ''' mult = a while(mult < b): print(str(m) + "" + str(mult) + "=" + str(mmult)) mult = mult+
def tablesMult(m, n, a, b): ''' ''' for i in range ( ): tableMultWhile( ) print("----")
def trianglePascal(hauteur): ''' ''' ligne = "1" for i in range(hauteur): print(ligne) nligne = "1" for j in range(len(ligne)-1): nligne = nligne + str(int(ligne[j]) + int(ligne[j+1])) nligne = nligne + "1" ligne = nligne
def longueurChaine(chaine): ''' ''' compteur = 0 for ch in chaine: compteur = compteur + 1 return(compteur)