Quick actions

cmd+k|ctrl+k

Navigation

Languages

Functional programming 

Snippet info

Language

Python

Visibility

public

Author

projectsfiae

Created

2025-08-28T18:51:11.323289Z

Updated

2025-08-28T18:59:21.061375Z

# separation pf concern
# clear and understandable
# easy to extend
# easy to maintain
# memory efficient 
# DRY

# pure function
# 1. given the same input and return the same result 
# 2. produces no side effect 
def multiply_by_two(li):
    new_list = []
    for i in li: 
        new_list.append(i*2)
    return new_list
    
print(multiply_by_two([1,2,3]))

# if the function returns print() then it is not pure function
INFO