The index(), count() and other "functions" you mention aren't standalone functions, they are methods of lists. That means you apply them to the list, like this: test = [1, 2, 3, 4, 5, 6] print(test.index(3)) # print index in list of the element of value 3 The list methods are described in the documentation . Answer from Deleted User on reddit.com
W3Schools
w3schools.com › python › ref_list_index.asp
Python List index() Method
Remove List Duplicates Reverse ... Q&A Python Bootcamp Python Training ... The index() method returns the position at the first occurrence of the specified value....
Reddit
reddit.com › r/learnpython › w3schools lists tutorials; half of the functions they use don't seem to work?
r/learnpython on Reddit: w3schools lists tutorials; half of the functions they use don't seem to work?
October 2, 2023 -
Total newbie here. Just been doing some basic exercises and I think the site I'm using is missing some advice, but its such a basic problem I've had no luck googling.
https://www.w3schools.com/python/python_lists.asp
Here they have a list of functions for working with lists; "index()"; "count()"; etc. and implies that these are "built in". However my Python install (3.11.5) doesn't have them as core. I assume I just need to import a module but w3 doesn't tell me which module to import.
Am I right? If so which module is it? I assume its really basic common knowledge.
Thanks x
Top answer 1 of 2
4
The index(), count() and other "functions" you mention aren't standalone functions, they are methods of lists. That means you apply them to the list, like this: test = [1, 2, 3, 4, 5, 6] print(test.index(3)) # print index in list of the element of value 3 The list methods are described in the documentation .
2 of 2
1
Can you mention explicitly what you've done and how Python reacts? I have 3.11.5, and the builtin list functions you've mentioned work just fine. >>> b = ['apple', 'banana', 'apple', 'cherry'] >>> b.count('apple') 2 >>> b.index('banana') 1
How can I take a list and pass it to a function as if I passed multiple variables? Mar 21, 2021
r/learnpython 5y ago
Learning about list functions - Creating a new list from index values
You could try using a zip() to combine the two lists and then filter from that. It will end up looking something like: For index, value in zip(input_list, value_list): I’ll let you carry on from there, but it essentially works the same way as unpacking a dictionary’s .items() Hope this gets you going in the right direction Edit ::: link for .zip() explanation https://www.w3schools.com/python/ref_func_zip.asp More on reddit.com
W3Schools - How useful are they?
I wouldn't recommend them that much, as they're more of a trick learner than an explanatory learning resource. Therefor I consider them more as a knowledge base than a good starting point to learn the language. Instead I would suggest to check out the list at r/learnpython/w/index at 'new to programming', there should be some that work well on a phone too. More on reddit.com
Videos
08:41
Loop Lists - Python Tutorial - w3Schools - Ch#22 English - YouTube
06:00
Remove list items Python Tutorial w3Schools Ch#21 English - YouTube
13:54
Lists in Python - Python Tutorial - w3Schools -Chapter-18 English ...
01:33
#69 Index Method in Python – Find an Element’s Position in a List!
How To Find Index Of Item In List Python
00:35
Python List Index Function: Find the Index of an Element in a List ...
Programiz
programiz.com › python-programming › methods › list › index
Python List index()
The index() method returns the index of the given element in the list.
DataCamp
datacamp.com › tutorial › python-list-index
Python List index() Method Explained with Examples | DataCamp
March 28, 2025 - This function is especially useful ... Master Python for data science and gain in-demand skills. ... The method index() returns the lowest index in the list where the element searched for appears....
Codecademy
codecademy.com › docs › python › lists › .index()
Python | Lists | .index() | Codecademy
June 11, 2025 - The .index() method is a built-in Python list method that returns the index position of the first occurrence of a specified element within a list.
GeeksforGeeks
geeksforgeeks.org › python › python-list-index
Python List index() - Find Index of Item - GeeksforGeeks
Explanation: a.index("dog") searches for "dog" in the list and element is found at index 1, so 1 is returned.
Published 1 day ago
Du
cs.du.edu › ~intropython › intro-to-programming › list_methods.html
List methods - Introduction to Programming
The call your_list.index(x) searches for the value x in your_list. It then returns an int which is the index of the first time that value appears in the list. One down side of the index() method is that x must be in the list - if it isn't then a ValueError results.
W3Schools
w3schools.com › python › python_lists_access.asp
Python - Access List Items
When specifying a range, the return value will be a new list with the specified items. ... thislist = ["apple", "banana", "cherry", "orange", "kiwi", "melon", "mango"] print(thislist[2:5]) Try it Yourself » · Note: The search will start at index 2 (included) and end at index 5 (not included). Remember that the first item has index 0.
W3Schools
w3schools.com › python › ref_tuple_index.asp
Python Tuple index() Method
The index() method finds the first occurrence of the specified value. The index() method raises an exception if the value is not found. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: ...
Simplilearn
simplilearn.com › home › resources › software development › python index: mastering list indexing techniques
Python List index() Method Explained with Examples
1 month ago - The Python index() method helps you find the index position of an element or an item in a string of characters or a list of items.
Address 5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
Tutorialspoint
tutorialspoint.com › python › list_index.htm
Python List index() Method
The Python List index() method is used to retrieve the lowest index in a list at which a specified object appears. The object can be anything; a single element or a collection of elements in the form of another list, tuple, set etc.
TUHH
www3.tuhh.de › sts › hoou › data-quality-explored › 0-5-3-lists.html
Lists and indexes — Data Quality Explored
Appending multiple elements to a list would create a sublist. To avoid a nested list then the extend( ) function can be used. ... index( ) is used to find the index value of a particular element.