+ 1

Help in python

How to index a element

13th Nov 2024, 2:52 AM
Pa Thé
5 Respostas
+ 7
Hii, index in python starts from 0 and is used to access an element from a list, try Sololearn lesson name "Indexing" for deep information.
13th Nov 2024, 11:07 AM
Gulshan Mahawar
Gulshan Mahawar - avatar
+ 5
Pa Thé , it would be better to share a code with us so that we can see (without guessing) what your issue is. in general: an index has to be an integer number or a variable that holds an integer number. by increasing or decreasing with a value we can modify the index number. in python indexes can be positive or negative, and does not necessarily need to start with the value of zero. indexes can be used with all sequences / iterables, so they are not limited to lists only. in python we can create an index number by using a for loop combined with an enumerator like: lst = [4,8,0,2,1] for ndx, num in enumerate(lst): ... > num is a variable that will get a value from the list, one at a time > ndx is a variable that will get an int value for indexing, that is incremented automatically in each loop iteration. you can find more about the enumerate() function in the python docs.
13th Nov 2024, 11:20 AM
Lothar
Lothar - avatar
+ 1
Do python course carefully and you'll be a pro on indexing.
13th Nov 2024, 1:23 PM
Ananda
Ananda - avatar
+ 1
Chill bro 🥲
14th Nov 2024, 11:53 AM
Ananda
Ananda - avatar
0
If you wanna help okay else shut up
13th Nov 2024, 5:04 PM
Pa Thé