Question: Help with fixing my code. When looping in reverse order, I cannot figure out how to fix it starting at number 8 instead of 1

Help with fixing my code. When looping in reverse order, I cannot figure out how to fix it starting at number 8 instead of 15 and it is spelling out number 8 instead of listing out the pokemons
#1creating a tuple with the names of 15 pokemon
Pokemon=('Pikachu', 'Charmander', 'Caterpie', 'Bulbasaur', 'Squirtle', 'Eevee', 'Vulpix', 'Ponyta', 'Arcanine', 'Weedle', 'Pidgey', 'Rattata', 'Ekans', 'Sandshrew', 'Clefairy')
#2print using single statement
print('Pokemon:', Pokemon)
#3looping and printing each state using the f strings
for Pokemon in Pokemon:
print(f"Yes! I just caught {Pokemon}!")
#4looping in reverse order using format method
for i in range(len(Pokemon)-1,-1,-1):
print('{} is Pokemon #{} I caught!'.format(Pokemon[i], i+1))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!