How to find the odd and even numbers using Python?

Here, In below code, user can enter two numbers to find the odd and even numbers between them. The number must be in between 1000 and 3000.

print("Please Enter the Number between 1000 and 3000")

print("Enter the First Number:")
first_number = input()

print("Enter the Second Number:")
second_number = input()

print("First Number: ", first_number)
print("Second Number: ", second_number)


if int(first_number) >= 1000 and int(second_number) <= 3000:
	first_number = int(first_number)
	second_number = int(second_number)

	even_numbers= []
	odd_numbers = []

	for i in range(first_number,(second_number+1)):
		if i%2 is 0:
			even_numbers.append(str(i))
		else: 
			odd_numbers.append(str(i))
	
else:
	print("Please enter a number between 1000 and 3000")

Leave a Comment