Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » Forum » x-Forum » Question

Sequences and while loop in python.-CppBuzz-Forum

Enter the sequence of numbers and find the amount and sum of numbers which end with 0. Use while loop.
Where is the mistake?
sek = [3, 5, 10, 67, 30, 20, 0, 1, 3, 0]
kiek = 0
suma = 0
i = 0
while i < len(sek):
    i += 1
    if i % 10 == 0:
        kiek += 1
        suma += i
print(kiek, suma)

Posted by austejaha 2020-10-06 00:13:13

No Ans Posted

Please login to comment

Log In


Ask New Question