samedi 10 octobre 2020

How to run a statement again and again on a case but on different occurrences [duplicate]

Hey guys I am making an encoding system in which each letter gets converted into predefined gibberish. For example, 'a' has already been set as 'ashgahsjahjs'.

But using if a in data: print("ashgahsjahjs") executes this for one time only, if there are more than one A in the word, it would not print them with gibberish.

Using a while loop does not work either as it keeps printing indefinitely, so is there a way to print the gibberish each time there is a new occurrence of a letter.

Aucun commentaire:

Enregistrer un commentaire