+ 2

What is the "index"?

19th May 2019, 6:29 PM
SwiTsoLt
6 ответов
+ 5
In Python: List is an ordered sequence of values. Index is the key for each value in the list. You can use the index to access a certain value from a list. Index is represented as a pair of square brackets [ ] including an index key after a list.
19th May 2019, 6:47 PM
Seb TheS
Seb TheS - avatar
+ 5
You are talking about list data structure... Hmmmm Hey, it's pretty simple. These are just the position at which an element is present inside a list. As you know it is an ordered collection of item that means every element belongs uniquely to it's place inside a list. https://code.sololearn.com/ccSQs7FiZIlq/?ref=app
20th May 2019, 6:24 AM
Ayush Sinha
Ayush Sinha - avatar
+ 3
Index An index refers to a position within a sequence. This means that you can point to a position in a sequence by using an index. Index are integer values, normally starting with 0, so the first element in a sequence has index [0], the second has index [1]. Index are used inside square brackets [..]. Sequences are strings, lists, tuples. Dictionaries and sets are not sequences because they do not support indexing. my_str = 'hello' my_str[0] # -> 'h' my_str[4] # -> 'o' my_str.index('e') # -> 1 my_list = ['abc', 'xyz'] my_list[1] # -> 'xyz' my_list[1][2] # > 'z' Indexes can also be used to iterate on sequences within loops.
19th May 2019, 8:48 PM
Lothar
Lothar - avatar
+ 3
Index in arrays, or indexes in database programming ? 🤔
20th May 2019, 2:01 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 3
Sanjay Kamath I thought of about indexing lists in Python, because there is a tag "lists" and SwitTsoLt has a Python course on 1/3.
20th May 2019, 4:42 AM
Seb TheS
Seb TheS - avatar
+ 1
index are used in array in []
19th May 2019, 6:54 PM
Pankaj Wandre
Pankaj Wandre - avatar