0% found this document useful (0 votes)
7 views

Module 4 Functions Assignment

MODULE – 4 ASSIGNMENT Functions Please write Python Programs for all the problems. 1. Write a Python function to find the Max of three numbers. 2. Write a Python function to sum all the numbers in a list. 3. Write a Python function to multiply all the numbers in a list.

Uploaded by

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

Module 4 Functions Assignment

MODULE – 4 ASSIGNMENT Functions Please write Python Programs for all the problems. 1. Write a Python function to find the Max of three numbers. 2. Write a Python function to sum all the numbers in a list. 3. Write a Python function to multiply all the numbers in a list.

Uploaded by

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

# -*- coding: utf-8 -*-

"""
Created on Tue Sep 17 18:32:46 2024

@author: Admin
"""

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

def maximum(a, b, c):

if (a >= b) and (a >= c):


largest = a

elif (b >= a) and (b >= c):


largest = b
else:
largest = c

return largest

# Driven code
a = int(input('Please enter 1st Integer:'))
b = int(input('Please enter 1st Integer:'))
c = int(input('Please enter 1st Integer:'))
print(maximum(a, b, c))

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

total = 0

# creating a list
list1 = [11, 5, 17, 18, 23]

# Iterate each element in list and add them in variable total


for ele in range(0, len(list1)):
total = total + list1[ele]

# printing total value


print("Sum of all elements in given list: ", total)

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

total = 1

# creating a list
list1 = [11, 5, 17, 18, 23]

# Iterate each element in list and add them in variable total


for ele in range(0, len(list1)):
total = total * list1[ele]

# printing total value


print("Multiple of all elements in given list: ", total)

You might also like