Complete-Python-3-Bootcamp
Complete-Python-3-Bootcamp copied to clipboard
summer of '69
im referring to the 'function practice solutions'
since while isnt gonna loop because of the code inside it, using if is better as it gets rid of the break statements too and does the same work but with lesser code
def summer_69(arr):
total = 0
add = True
for num in arr:
if add:
if num != 6:
total += num
else:
add = False
if not add:
if num == 9:
add = True
return total