Skip to content

AiswaryaReghurajNair/Python-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Python-functions

Exercise 1: Create a function that takes in three arguments, two of which are optional. The first argument should be a required positional argument, the second argument should be a keyword argument with a default value of 10, and the third argument should be a keyword argument with a default value of None. The function should print the sum of the first two arguments if the third argument is None, and print the product of all three arguments if the third argument is not None.

Exercise 2: Write a function that takes in a list of strings and returns a new list with only the strings that have a length greater than or equal to 5.

Exercise 3: Write a Python program to evaluate a given mathematical expression using the eval() function. expression = "3 * 5 + 2"

Exercise 4: Write a Python program to filter out the prime numbers from a given list of integers using the filter() function.

Exercise 5: Write a Python program to convert a list of strings to uppercase using the map() function.

Exercise 6: Write a Python program to calculate the length of each string in a given list of strings using the map() function.

Exercise 7: Write a Python program to calculate the sum of elements in a list using the reduce() function.

Exercise 8: Write a Python program to find the maximum element in a list using the reduce() function.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published