python get odd numbers code example
Example 1: program to find even numbers in python
m = int(input("Enter number"))
if m % 2 == 0:
print(m,"is an even number")
else:
print(m,"is an odd number")
Example 2: how to sum only the odd values in python
>>> lst = [0, 1, 2, 3, 4, 5]>>> sum(n for n in lst if n % 2 != 0)9