To write a program to find the maximum of a list of numbers.
- Hardware – PCs
- Anaconda – Python 3.7 Installation / Moodle-Code Runner
- Get the list of marks as input
- Use the sort() function or max() function or use the for loop to find the maximum mark.
- Return the maximum value
def max_marks(marks):
marks.sort()
max=marks[-1]
return max
def max_marks(marks):
max_marks=max(marks)
return max_marks
def max_marks(list1):
max=0
for i in list1:
if i>max:
max=i
return max
Thus the program to find the maximum of given numbers from the list is written and verified using python programming.