0% found this document useful (0 votes)
0 views2 pages

Python Task4

The document lists a series of programming tasks that involve creating various functions and programs in Python. These tasks cover topics such as arithmetic operations, string manipulation, statistical calculations, and the use of built-in functions like filter and map. Additionally, it includes exercises on random number generation and control flow structures.

Uploaded by

Anandhu PA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views2 pages

Python Task4

The document lists a series of programming tasks that involve creating various functions and programs in Python. These tasks cover topics such as arithmetic operations, string manipulation, statistical calculations, and the use of built-in functions like filter and map. Additionally, it includes exercises on random number generation and control flow structures.

Uploaded by

Anandhu PA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Write a function that takes an integer as input and prints whether it's even or odd.

2.
a. Write a function that takes two numbers as input and returns their sum.
3. Write a function that takes two numbers as input and returns their sum.
4. Write a function to calculate the factorial of a given number.
5. Write a function that filters out numbers less than 10 from a list.
6. Write a program that prints the numbers from 1 to 100. But for multiples of three,
print "Fizz" instead of the number, and for the multiples of five, print "Buzz." For
numbers that are multiples of both three and five, print "FizzBuzz."
7. Write a function that returns the maximum of three numbers.
8. Write a function to reverse a given string.
9. Write a function that checks whether a given number is prime.
10. Create a dictionary and write a program to print its keys and values
11. Write a program to print even numbers from 2 to 20
12. Write a program to calculate the sum of all numbers from 1 to 100
13. Write a program to calculate the average of a list of numbers using a loop.
14. Write a function called greet that takes a name as an argument and prints a greeting
message.
15. Write a function called multiply that takes two numbers as arguments and returns
their product. Include a default value of 1 for the second number.
16. Write a function called calculate_sum that can take any number of arguments and
returns their sum.
17. Write a function called calculate_stats that takes a list of numbers as input and
returns the sum, mean, and median of the numbers.
18. rite a function called square that takes a number as an argument and returns its
square. Include a docstring that explains the purpose of the function.
19. Write a lambda function that takes two numbers as arguments and returns the
maximum of the two.
20. rite a lambda function that takes three parameters and returns their product.
21. Given a list of numbers, use the filter function with a lambda function to filter out
the even numbers.
22. Given a list of numbers, use the map function with a lambda function to square each
number in the list.
23. Write a lambda function that returns "Even" if the input is even and "Odd" if the input
is odd.
24. Write a lambda function that returns "Positive" if the input is greater than 0,
"Negative" if it's less than 0, and "Zero" if it's equal to 0.
25. Write a program that takes a decimal number as input and prints its ceiling and floor
values using the math module.
26. Write a function that generates and returns a random integer between 1 and 100
using the random module.
27. Write a program that randomly selects and prints three elements from a list using the
random module.
28. Write a program that generates and prints 10 random numbers from a normal
distribution using the random module.
29. rite a program to input a number and print the sum of its digits using a loop.
30. Write a program to count down from 10 to 1 using a while loop.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy