Sum of List Python || While Loop || Python
In this we are going to see a basic program for adding all numbers in a list with while loop in Python Programming Language.


def add_items():
    i = 0
    numbers = []
    while i < 6:
        print("At the top i is %d" % i)
        numbers.append(i)
        i += 1
        print("Numbers now: ", numbers)
        print("At the bottom i is %d" % i)
    print("The numbers: ")
    for num in numbers:
        print(num)

add_items()

# Coded By Dhiraj Shelke

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post