generated from mwc/lab_weather
	I didn't properly read the instructions and I kept getting confused by what the data looked like so I created a trials folder and I used it to dissect the data. Once it was clear that I was looking at a list of dictionaries, it became very easy to create my first two functions. It's necessary to know what the dataset looks like structurally.
		
			
				
	
	
		
			96 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			96 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
family = [
 | 
						|
    {
 | 
						|
	"name": "Tad Winters",
 | 
						|
	"email": "ligula.aenean@hotmail.edu",
 | 
						|
        "favorite_colors": ["aqua", "red"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Raphael Chambers",
 | 
						|
	"email": "ac.eleifend.vitae@protonmail.com",
 | 
						|
        "favorite_colors": ["blue"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Perry Calderon",
 | 
						|
	"email": "mus.donec@outlook.org",
 | 
						|
        "favorite_colors": ["black", "white", "grey"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Walker Hurley",
 | 
						|
	"email": "auctor.odio@icloud.ca",
 | 
						|
        "favorite_colors": ["red", "yellow", "blue", "orange"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Clementine Joseph",
 | 
						|
	"email": "hendrerit@aol.co.uk",
 | 
						|
        "favorite_colors": ["yellow", "aqua", "black"],
 | 
						|
    }
 | 
						|
]
 | 
						|
 | 
						|
friends = [
 | 
						|
    {
 | 
						|
        "name": "Connor Rodriguez",
 | 
						|
	"email": "maecenas@yahoo.edu",
 | 
						|
        "favorite_colors": ["aqua", "teal", "sea foam", "turquoise"],
 | 
						|
	},
 | 
						|
    {
 | 
						|
	"name": "Rosalyn Hubbard",
 | 
						|
	"email": "elit.pharetra@google.edu",
 | 
						|
        "favorite_colors": ["red", "yellow", "black"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Thomas Puckett",
 | 
						|
	"email": "sit.amet@aol.net",
 | 
						|
        "favorite_colors": ["blue"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Yuli Reynolds",
 | 
						|
	"email": "augue.malesuada@google.edu",
 | 
						|
        "favorite_colors": [],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Joy Tate",
 | 
						|
	"email": "risus.a.ultricies@hotmail.org",
 | 
						|
        "favorite_colors": ["white", "grey", "sand"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Prescott Price",
 | 
						|
	"email": "cursus.nunc@yahoo.edu",
 | 
						|
        "favorite_colors": ["red", "blue", "green"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Josephine Keller",
 | 
						|
	"email": "nulla@protonmail.edu",
 | 
						|
        "favorite_colors": ["black"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Isadora Carney",
 | 
						|
	"email": "sagittis.lobortis@protonmail.co.uk",
 | 
						|
        "favorite_colors": ["aqua", "lime"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Jelani West",
 | 
						|
	"email": "vehicula.pellentesque.tincidunt@yahoo.org",
 | 
						|
        "favorite_colors": ["grey", "beige", "tan"],
 | 
						|
    },
 | 
						|
    {
 | 
						|
	"name": "Gay Pittman",
 | 
						|
	"email": "etiam.bibendum@yahoo.org",
 | 
						|
        "favorite_colors": ["yellow"],
 | 
						|
    }
 | 
						|
]
 | 
						|
 | 
						|
def get_email(people, name):
 | 
						|
    """Returns the named person's email address. If there is no such person, returns None.
 | 
						|
 | 
						|
        >>> get_email(family, "Tad Winters")
 | 
						|
        "ligula.aenean@hotmail.edu"
 | 
						|
        >>> get_email(friends, "Tad Winters")
 | 
						|
        None
 | 
						|
    """
 | 
						|
 | 
						|
for n in friends:
 | 
						|
    if n['name']=="Tad Winters":
 | 
						|
        print(n['email'])
 | 
						|
    else:
 | 
						|
        print(None)
 |