Learn Python Lists

You are here: Home » MiltonMarketing Blog » Computer Programming Languages » Python » Learn Python Lists

Learn Python Lists


In this exercise, you will need to add numbers and strings to the correct lists using the “append” list method. You must add the numbers 1,2, and 3 to the “numbers” list, and the words ‘hello‘ and ‘world‘ to the strings variable.

You will also have to fill in the variable second_name with the second name in the names list, using the brackets operator [ ]. Note that the index is zero-based, so if you want to access the second item in the list, its index will be 1.

numbers = []
strings = []
names = ["John", "Eric", "Jessica"]

# code already done here.


second_name = names[1]

# this code should write out the filled arrays and the second name in the names list (Eric).
print("The second name on the names list is %s" % second_name)

Trinket.io on-line Python compiler


Related Videos:

MiltonMarketing.com Related Videos.

Related Posts:

The Python Standard Library Ver 3.6.5

Learn about Dictionaries datatype for Python

Python Basic String Operations

Python Basic Operators

Learn about programming Loops in Python

Learn about Python Sets (lists)

Exception Handling in Python programming

Object-Oriented Programming (OOP)

How can Alice help teach OOP (Object Oriented Programming)?



By |2019-02-08T19:21:24-04:00April 7th, 2018|Categories: Computer Programming Languages, Python|Tags: , |

About the Author:

I am a loving father, & husband. I am a computer enthusiast. I have used and enjoyed computers since I was young and I enjoy teaching young minds how to code, because it teaches them how to think. Today with YouTube, and social media garbage our youth are losing the ability to think on their own and solve problems. I believe this is a serious epidemic as kids today dont understand that technology is a tool. This tool is being abused, and its underlying effects are taking its toll on kids behaviour, and learning.