Write a Python program to get the largest number from a list


Topic: Write a Python program to get the largest number from a list

Solution

def max_num_in_list(list):
    max = list[0]
    for a in list:
        max = a if a > max else max
    return max
print(f'max_num_in_list [1, 10, -8, 0], Ans:{max_num_in_list([1, 10, -8, 0])}')



List all Python Programs