0
a quizz
return the sum of the numbers in the array, except ignore sections of numbers starting with a 6 and extending to the next 7(every 6will be followed by at least one 7). Return 0 for no numbers.
1 Odpowiedź
+ 1
I think it could be something like this (in python):
a = [1, 4, 6, 8, 7, 4, 5, 6, 8, 9, 7]
z = 0
res = 0
for i in a:
if i == 6:
z = 1
if z == 0:
res += i
if i == 7:
z = 0
print ("The result =", res)