Loop over lists of lists

PHOTO EMBED

Thu Nov 25 2021 15:55:42 GMT+0000 (Coordinated Universal Time)

Saved by @Sourabh #numpy #booleans_in_numpy #list #forloop #for #loop

# house list of lists
house = [["hallway", 11.25], 
         ["kitchen", 18.0], 
         ["living room", 20.0], 
         ["bedroom", 10.75], 
         ["bathroom", 9.50]]
         
# Build a for loop from scratch
for x in house :
    #x[0] to access name of room
    #x[1] to access area in sqm
    print('the ' + x[0] + " is " + str(x[1]) + " sqm")
content_copyCOPY