for en python 1

for en python

animales = ['gato', 'perro', 'serpiente']
for animal in animales:
    print "El animal es: {0}, tamaño de palabra es: {1}".format(
        animal, len(animal))

Here is what the above code is Doing:
1. We create a list of animals.
2. We create a for loop that iterates over each animal in the list.
3. We print out a string that tells us the animal and the length of the animal’s name.

Similar Posts