Exe 3.3

i=0
for caractere in 'Pzythorzn': # First Example
  if caractere == 'z':
     i=i+1

print(i)

Exercice 3.6

mot_secret = "bonjour le monde"
chaine_crypter = ""
decalage = 3
c = "a"
print(c, ord(c))
c = "z"
print(c, ord(c))

for c in mot_secret :
  @nbsp;chaine_crypter = chaine_crypter +chr(ord(c)+decalage)

print(chaine_crypter)

chaine_decrypter = ""
for c in chaine_crypter :
  @nbsp;chaine_decrypter = chaine_decrypter +chr(ord(c)-decalage)
print(chaine_decrypter)

Affichages : 3133