Count of Even and Odd in Python || While Loop || Python
In this we are going to see a basic program about count of even and odd numbers using while loop in Python Programming Language.


def count_even_odd():
    i = 0
    numbers = [1,2,3,4,5,6,7,8,9]
    even = 0
    odd = 0
    while i < len(numbers):
        if numbers[i] % 2 == 0:
            even += 1
        else:
            odd += 1
        i += 1
    print("Even: %d" % even)
    print("Odd: %d" % odd)

count_even_odd()

# 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