Programming Examples

Python program to create a list of numbers in the range 1 to 10 Then delete all the even numbers from the list and print the final list


Write a program to create a list of numbers in the range 1 to 10. Then delete all the even numbers from the list and print the final list.

Solution

Num = []
for x in range(1,11):
	Num.append(x)
print("The list of numbers from 1 to 10 = ", Num)
for index, i in enumerate(Num):
	if(i%2==0):
		del Num[index]
print("The list after deleting even numbers = ", Num)
▶ RUN

Output/ Explanation:

The list of numbers from 1 to 10 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

The list after deleting even numbers = [1, 3, 5, 7, 9]

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad