3 Réponses
+ 3
Use max() function
arr = [3, 9, 1]
print(max(arr))
Output: 9
+ 5
#you could also use sort / sorted
arr = [3, 9, 1]
print(sorted(arr)[-1])
#Output: 9
+ 2
If there were not ways to do this with standard functions you can solve it with loops and it can be a good exercise.
l=[56,32,85,74,110,2,99,115]
t=0
for n in l:
if t<n:
t=n
print(t)