Python Forum
find the index of "Annual" in spell_list
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
find the index of "Annual" in spell_list
#1
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])
Reply
#2
There is list.index() method for the lists.
https://docs.python.org/3.5/tutorial/dat...tures.html
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  labels.append(self.classes.index(member.find('name').text)) hobbyist 1 1,933 Dec-15-2021, 01:53 PM
Last Post: deanhystad
  pandas pivot table: How to find count for each group in Index and Column JaneTan 0 3,321 Oct-23-2021, 04:35 AM
Last Post: JaneTan
  str.find() not returning correct index. DreamingInsanity 10 4,280 Aug-18-2020, 05:41 PM
Last Post: DreamingInsanity
  Find index value in List Martin2998 3 2,807 May-12-2020, 02:17 PM
Last Post: deanhystad
  How to find something in a list using its index rix 1 1,736 Dec-20-2019, 04:12 PM
Last Post: stullis
  Find index of missing number parthi1705 3 3,161 May-07-2019, 10:52 AM
Last Post: avorane
  How Do I find Index of a character in string? ilcaa72 5 3,758 May-23-2018, 11:44 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020