def square(x):
return x**2
numbers = [1, 2, 3, 4, 5]
squares = map(square, numbers)
print(list(squares)) # Output: [1, 4, 9, 16, 25]
def is_even(x):
return x % 2 == 0
numbers = [1, 2, 3, 4, 5]
evens = filter(is_even, numbers)
print(list(evens)) # Output: [2, 4]
from functools import reduce
def multiply(x, y):
return x * y
numbers = [1, 2, 3, 4, 5]
product = reduce(multiply, numbers)
print(product) # Output: 120
product = reduce(multiply, numbers, 10)
print(product) # Output: 1200
do you have any course please making website whit phyton ?
thank u so much I'll wait for itActually yes. I’m gonna share it soon.
I did! Check my thread: https://memoryhackers.org/konular/how-to-create-a-website-using-python.268148/thank u so much I'll wait for it
awsome I need it thank you again <3
def square(x):
return x**2
numbers = [1, 2, 3, 4, 5]
squares = map(square, numbers)
print(list(squares)) # Output: [1, 4, 9, 16, 25]
def is_even(x):
return x % 2 == 0
numbers = [1, 2, 3, 4, 5]
evens = filter(is_even, numbers)
print(list(evens)) # Output: [2, 4]
from functools import reduce
def multiply(x, y):
return x * y
numbers = [1, 2, 3, 4, 5]
product = reduce(multiply, numbers)
print(product) # Output: 120
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?