Program nie działa, gdy 0 jest na początku, np.
0 1 2 3 4 5
kończy program zamiast wypisać 15. Jak dla mnie jest to nieprawidłowe zachowanie - spróbuj poprawić, powinno przejść.
Btw 1 . linia:
for i in range(1):
jest tożsama:
i = 0
Btw 2. czy te wszystkie rzutowania są konieczne?
current_sum = 0
total_sum = 0
var = 1
while var:
numbers = [int(x) for x in input().split()]
if not numbers[0]:
print(0)
print(total_sum)
var = 0
else:
for number in numbers:
if(number != 0):
current_sum += number
total_sum += current_sum
print(current_sum)
current_sum = 0