In this program, we will find the maximum number from the list.
Steps to solve the program
- Take a list as input and create a variable to find the maximum number from the list and assign its value equal to 0.
- Use for loop to iterate over the list elements.
- If an element from the list is greater than the variable that we have created then change the value of the variable by that element.
- Print the output.
list1 = [12,14,45,88,63,97,88]
max_ = 0
for i in list1:
if i > max_:
max_ = i
print("Maximum number: ",max_)
Output :
Maximum number: 97