Skip to content

Latest commit

 

History

History
 
 

01.1-Access-and-Retrieve

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
tutorial

01.1 Access and retrieve

Lists are part of every programming language. They are the way to go when you want to have a 'list of elements'.

For example, we could have a list that stores the days of the week:

my_list = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']

What is a list?

Every list has the following parts:

  • Items: are the actual values inside each position of the list.

  • Length: is the size of the list, the number of items.

  • Index: is the position of an element.

To access any particular item within the list, you need to know its index (position).

The index is an integer value that represents the position in which the element is located.

🔎 Important:

Every list starts from zero (0), so to get the first item we'd use my_list[0].

📝 Instructions:

  1. Using the print() function, print the 3rd item from the list.

  2. Change the value in the position where thursday is located to None.

  3. Print the particular position of step two.