Aug-15-2018, 10:55 PM
Hi all,
I am currently following the course Intro to Python for Data Science with Datacamp.com. It is pretty challenging for me as someone who does not know much about coding and such things. But it is interesting to learn more about Python.
My exercise is this:
(1)Print out the second element from the areas list, so 11.25.
(2)Subset and print out the last element of areas, being 9.50. Using a negative index makes sense here!
(3)Select the number representing the area of the living room and print it out.
This is my script based on the exercise:
Thanks in advance
I am currently following the course Intro to Python for Data Science with Datacamp.com. It is pretty challenging for me as someone who does not know much about coding and such things. But it is interesting to learn more about Python.
My exercise is this:
(1)Print out the second element from the areas list, so 11.25.
(2)Subset and print out the last element of areas, being 9.50. Using a negative index makes sense here!
(3)Select the number representing the area of the living room and print it out.
This is my script based on the exercise:
# Create the areas list areas = ["hallway", 11.25, "kitchen", 18.0, "living room", 20.0, "bedroom", 10.75, "bathroom", 9.50] # Print out second element from areas print(areas[11.25]) # Print out last element from areas print(areas[9.50]) # Print out the area of the living room print(areas[20.0])I get an error on line 5, but I don't really understand what I am doing wrong. Or if I might misunderstood the exercise.
Thanks in advance