Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions class3/7_count_even_and_odd_number.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#counting odd and even number in list
l=[1,2,3,4,5,6,7,8,9]
l=[1,2,3,4,5,6,7,8,9] #list of even and odd numbers
odd=0
even=0
for x in l:
if x%2==0:
even+=1
even+=1 #count the even no
else:
odd=odd+1
print("number of odd numbers in the list is :"+str(odd))
print("number of even numbers in the list is :"+str(even))
odd=odd+1 #count the odd no
print("number of odd numbers in the list is :"+str(odd))
print("number of even numbers in the list is :"+str(even))