# Why Your Lambda Function Does Not Work

## Basis usage of lambda

`square = lambda x: x**2 print(square(4)) #Output: 16 cryptocurrencies = [('Bitcoin', 10948.52),('Ethereum', 381.41),('Tether', 1.00), ('XRP', 0.249940), ('Bitcoin Cash', 231.86), ('Polkadot', 4.91), ('Binance Coin', 27.02), ('Chainlink', 10.47), ('Litecoin', 48.20), ('EOS', 2.69), ('TRON', 0.027157), ('Neo', 24.29), ('Stellar', 0.077903), ('Huobi Token', 4.91)] top5_by_name = sorted(cryptocurrencies, key=lambda token: token.lower())[0:5] print(top5_by_name) #Output: [('Binance Coin', 27.02), ('Bitcoin', 10948.52), ('Bitcoin Cash', 231.86), ('Chainlink', 10.47), ('EOS', 2.69)] lowest = min(cryptocurrencies, key=lambda token: token) print(lowest) #Output: ('TRON', 0.027157) highest = max(cryptocurrencies, key=lambda token: token) print(highest) #Output: ('Bitcoin', 10948.52) highest_in_local_currency = lambda exchange_rate: highest * exchange_rate highest_sgd = highest_in_local_currency(1.38) print(highest_sgd) #Output: 15108.9576`
`highest = ('Bitcoin', 10948.52) mon_highest = lambda exchange_rate: highest * exchange_rate highest = ('Bitcoin', 10000) tue_highest = lambda exchange_rate: highest * exchange_rate print("Mon:", mon_highest(1.36)) print("Tue:", tue_highest(1.36))`
`converters = [lambda exchange_rate: crypto * exchange_rate for crypto in cryptocurrencies] for c in converters:     print(c(1.36))`

## Runtime data binding

`mon_highest = lambda exchange_rate,highest = highest: highest * exchange_rate tue_highest = lambda exchange_rate,highest = highest: highest * exchange_rate`
`converters = [lambda exchange_rate,crypto = crypto: crypto * exchange_rate for crypto in cryptocurrencies]`
`list(map(lambda crypto: crypto * 1.36, cryptocurrencies))`

Written by