Sum of Odd and Even Numbers in Python || List || Python
In this we are going to see a basic program to find Sum of Odd and Even Numbers in Python Programming Language.

list1 = list(range(0, 10))
print("The List : ", list1)
# Using Slicing With Gap Of Two
odd = list1[1:10:2]
print("The Odd Elements Are : ", odd)
even = list1[0:10:2]
print("The Even Elements Are : ", even)
print("---------------------------------------------------------------")
print("The Sum Of All Even Elements Is : ", sum(even))
print("The Sum Of All Odd Elements Is : ", sum(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