Dating App

Report a typo

You have a list of potential dates, where each person is represented by a dictionary containing their name, gender, age, hobbies, and city. Here's a sample of what the list might look like:

potential_dates = [
    {
        "name": "Sasha",
        "gender": "male",
        "age": 18,
        "hobbies": ["rock music", "art"],
        "city": "Berlin",
    },
    {
        "name": "Maria",
        "gender": "female",
        "age": 35,
        "hobbies": ["art"],
        "city": "Berlin",
    },
    {
        "name": "Daniel",
        "gender": "non-conforming",
        "age": 50,
        "hobbies": ["boxing", "reading", "art"],
        "city": "Berlin",
    },
    {
        "name": "John",
        "gender": "male",
        "age": 41,
        "hobbies": ["reading", "alpinism", "museums"],
        "city": "Munich",
    },
]

Complete the select_dates() function that takes the potential_dates list as an argument and returns a string containing the names of people who meet all of the following criteria:

  1. Age is greater than 30

  2. Interested in art (i.e., "art" is in their hobbies list)

  3. Living in Berlin

The names in the returned string should be separated by commas and a space.

For the potential_dates list provided above, the expected output is

Maria, Daniel
Write a program in Python 3
def select_dates(potential_dates):
...
___

Create a free account to access the full topic