Intro to Python Flashcards
Build list so that the list first contains the name of each room as a string and then its area. ADD STRINGS IN SAME LINE: “hallway”, “kitchen” and “bedroom” at the appropriate locations.
areas = [“hallway”, hall, “kitchen”, kit, “living room”, liv, “bedroom”, bed, “bathroom”, bath]
Build list so that the list first contains the name of each room as a string and then its area. DO AS LIST OF LISTS:”hallway”, “kitchen” and “bedroom” at the appropriate locations.
house = [[“hallway”, hall],
[“kitchen”, kit],
[“living room”, liv],
[“bedroom”, bed],
[“bathroom”, bath]]
Show/Print second element from df called ‘areas’
print(areas[1])
Use slicing to create a list, downstairs, that contains the first 6 elements of areas:
areas = [“hallway”, 11.25, “kitchen”, 18.0, “living room”, 20.0, “bedroom”, 10.75, “bathroom”, 9.50]
downstairs = areas[:6]
Use slicing to create upstairs, as the last 4 elements of areas
upstairs = areas[-4:]