Python Forum

Full Version: find the index of "Annual" in spell_list
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
my question here
I am not getting the proper output. Please help.
find the index of "Annual" in spell_list
# [ ] using range, print the spell_list including "Annual" to end of list

spell_list = ["Tuesday", "Wednesday", "February", "November", "Annual", "Calendar", "Solstice"]
for count in range(4,len(spell_list)):
    print(spell_list[count])

from pprint import pprint
spell_list = ["Tuesday", "Wednesday", "February", "November", "Annual", "Calendar", "Solstice"]
b=dict(enumerate(spell_list))
pprint(b[4])
There is list.index() method for the lists.
https://docs.python.org/3.5/tutorial/dat...tures.html