Answer to Question #336112 in Python for Elle Joy

Question #336112

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.

1
Expert's answer
2022-05-01T19:05:51-0400
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]))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS