-2
Recursive function that receives a lista
and return the highest value from that list.
def maior(lista):
maior=0
if len(lista)==0:
return lista
elif len(lista)==1:
return lista
else:
for i in lista:
if lista[0]> maior:
maior=lista[0]
return maior
lista=[-1,0,1,2,3]
The question suggested above in the blue box is not 100% identical, because there returns the largest and smallest, but it is not difficult to adapt the code to return only the largest (in the background, the general idea is the same)
– hkotsubo