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

Python Functions: Max, Sum, Multiply

The document contains Python programming assignments focused on functions. It includes tasks to find the maximum of three numbers, sum all numbers in a list, and multiply all numbers in a list. Sample code snippets are provided for each task to illustrate the expected implementations.

Uploaded by

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

Python Functions: Max, Sum, Multiply

The document contains Python programming assignments focused on functions. It includes tasks to find the maximum of three numbers, sum all numbers in a list, and multiply all numbers in a list. Sample code snippets are provided for each task to illustrate the expected implementations.

Uploaded by

Godwin Sam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

MODULE – 4 ASSIGNMENT

Functions

Please write Python Programs for all the problems.

1. Write a Python function to find the Max of three numbers.

my_list = [10, 5, 8]
if len(my_list)==3:
print(max(my_list))

2. Write a Python function to sum all the numbers in a list.

def sum(numbers):
total = 0
for num in numbers:
total += num
return total
numbers_list = [1, 2, 3, 4, 5]
print("Sum of numbers in the list:", sum(numbers_list))

3. Write a Python function to multiply all the numbers in a list.

list1 = [1, 2, 3, 4, 5]

squares1 = []

for i in list1:

[Link](i ** 2)

print(squares1)

© 360DigiTMG. All Rights Reserved.


© 360DigiTMG. All Rights Reserved.

You might also like