xxxxxxxxxx
x = [i for i in range(4,15+1) if i%2!=0]
print(*x)
xxxxxxxxxx
# Python program to print Even Numbers in given range
start = int(input("Enter the start of range:"))
end = int(input("Enter the end of range:"))
# iterating each number in list
for num in range(start, end + 1):
# checking condition
if num % 2 != 0:
print(num)
xxxxxxxxxx
# Python code To print all odd numbers
# in a given range using the lambda function
a=3;b=11
li=[]
for i in range(a,b+1):
li.append(i)
# printing odd numbers using the lambda function
odd_num = list(filter(lambda x: (x%2!=0),li))
print(odd_num)
xxxxxxxxxx
# Uncomment the below two lines for taking the User Inputs
#start = int(input("Enter the start of range: "))
#end = int(input("Enter the end of range: "))
# Range declaration
start = 5
end = 20
if start % 2 != 0:
for num in range(start, end + 1, 2):
print(num, end=" ")
else:
for num in range(start+1, end + 1, 2):
print(num, end=" ")
xxxxxxxxxx
a=4;b=15;l=[]
for i in range(a,b+1):
l.append(i)
print([a for j,a in enumerate(l) if a%2!=0])