def sum_positive(lst):
number = 0
for num in range(len(lst)):
if lst[num] >= 0:
number += lst[num]
return number
Can someone please explain to me what is the purpose of range(len(lst))? And explain step-by-step the execution of the for statement?
Aucun commentaire:
Enregistrer un commentaire