Skip to content

Instantly share code, notes, and snippets.

View ItsCosmas's full-sized avatar
🔨
Building

Cozy! ItsCosmas

🔨
Building
View GitHub Profile
@ItsCosmas
ItsCosmas / lambdas.py
Created May 7, 2019 10:13
Lambda Functions
# Functions on the go, without assigning them to a variable
# Anonymous functions
def square(x):
return x*x
print(square(2))
print((lambda x: x*x)(4))
@ItsCosmas
ItsCosmas / maps.py
Last active May 8, 2019 20:05
Maps
#MAPS
def addFive(x):
return x + 5
nums = [11,22,33,44,55]
result = list(map(addFive,nums))
print(result)
nums = [11,22,33,44,55]
result = list(map(lambda x:x+5,nums))
print(result)