Skip to content

Instantly share code, notes, and snippets.

# Function to get names of users older than 18
def users_above_18(users):
# Create an empty list to store names
names = []
# Loop through each user dictionary in the list
for u in users:
# Check if the user's age is greater than 18
if u["age"] > 18:
# Add the user's name to the list "names"