Student Activity
Student Activity Guide:
1) Defining and Calling Functions
def add_numbers(a, b):
return a + b
print(add_numbers(5, 10)) # Output: 15
# Function to check if a number is prime
def is_prime(n):
if n < 2:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
print(is_prime(11)) # Output: True2) Lambda Functions and Anonymous Functions
3) Using Map, Filter, and Reduce
4) Recursion and Higher-Order Functions
Student Exercises:
Last updated