We can access the values from a list by using index values. We will specify the index number inĀ [ and ]. Index starts from 0. Refer to the given example:
#!/usr/bin/python3
cities = ['Mumbai', 'Bangalore', 'Chennai', 'Pune']
numbers = [1, 2, 3, 4, 5, 6, 7 ]
print (cities[0])
print (numbers[1:5])
Output:
Mumbai
[2, 3, 4, 5]