Lambda-Custom

Sat 17 May 2025

title: "Lambda Custom" author: "Raja CSP Raman" date: 2019-04-20 description: "-" type: technical_note draft: false


cities = [
    'chennai', 'delhi', 'madurai', 'pune', 'bengaluru'
    ]
cities
['chennai', 'delhi', 'madurai', 'pune', 'bengaluru']
def is_south_indian_city(city):
    if city == 'chennai' or city == 'madurai' or city == 'bengaluru':
        return True

    return False
new_list = list(filter(lambda x: is_south_indian_city(x) , cities))
new_list
['chennai', 'madurai', 'bengaluru']


Score: 5

Category: basics