Proposition de correction :
def conversion_minuscules(texte):
texte_retour=""
for lettre in texte:
position_lettre=ord(lettre)
if 65<=position_lettre<=90:
lettre_min=chr(position_lettre+32)
texte_retour+=lettre_min
else:
texte_retour+=chr(position_lettre)
return texte_retour
def conversion_majuscules(texte):
texte_retour=""
for lettre in texte:
position_lettre=ord(lettre)
if 97<=position_lettre<=122:
lettre_min=chr(position_lettre-32)
texte_retour+=lettre_min
else:
texte_retour+=chr(position_lettre)
return texte_retour
def presence_majuscules(texte):
for lettre in texte:
position_lettre=ord(lettre)
if 65<=position_lettre<=90:
return True
return False
def presence_minuscules(texte):
for lettre in texte:
position_lettre=ord(lettre)
if 97<=position_lettre<=122:
return True
return False
def presence_chiffres(texte):
for lettre in texte:
position_lettre=ord(lettre)
if 48<=position_lettre<=57:
return True
return False
def presence_speciaux(texte):
for lettre in texte:
position=ord(lettre)
if position<48 or 57<position<65 or 90<position<97 or position>122 :
return True
return False
def presence_speciaux1(texte):
for lettre in texte:
position=ord(lettre)
if not(97<=position<=122) and not(97<=position<=122) and not(48<=position<=57) :
return True
return False
def mdp_secure(mot):
if len(mot)>=8 and presence_majuscules(mot) and presence_minuscules(mot) and presence_chiffres(mot) and presence_speciaux(mot):
return True
return False