Create a list
A list is a compound data type; you can group values together, like this:
a = "is"
b = "nice"
my_list = ["my", "list", a, b]
After measuring the height of your family, you decide to collect some information on the house you're living in. The areas of the different parts of your house are stored in separate variables in the exercise.
This exercise is part of the course
Introduction to Python
Exercise instructions
- Create a list,
areas
, that contains the area of the hallway (hall
), kitchen (kit
), living room (liv
), bedroom (bed
) and bathroom (bath
), in this order. Use the predefined variables. - Print
areas
with theprint()
function.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
hall = 11.25
kit = 18.0
liv = 20.0
bed = 10.75
bath = 9.50
# Create list areas
# Print areas