Elle Joy Vasquez
Preliminary Test 04
Create a Python function that takes a list of n integers and returns the largest number among the n integers.
def largest_num(lst:list) -> list:
largest = None
for num in lst:
if largest is None:
largest = num
else:
if num > largest:
largest = num
return largest
print(largest_num([1,2,10,25,25,5]))
Comments
Leave a comment