samedi 25 juillet 2015

if function in Python

I want to write a code that will count the numbers digit X found in string Y and do the following

When digit X appears 1 time it will show the expression Z

When digit X appears 2 times it will show the expression ZZ

When digit X appears 3 times it will show the expression ZZZ

What is the easiest way to do it?

Aucun commentaire:

Enregistrer un commentaire