CoursesProgramsCompaniesQuizPrepAbout
Programs/Python/Loop Programs

3 / 25

Next
1. Print Numbers 1–1002. Print Even Numbers in Range3. Print Odd Numbers in Range4. Sum of Digits5. Reverse Digits of a Number6. Calculate Factorial (Loop)7. Fibonacci Series8. Palindrome Number Check9. Count Digits in a Number10. GCD of Two Numbers (Loop)11. LCM of Two Numbers (Loop)12. Print Prime Numbers in Range13. Count Prime Numbers in Range14. Check Composite Number15. Power of 2 Checker16. Print Number Pattern17. Print Star Pattern18. Armstrong Numbers in Range19. Strong Numbers in Range20. Sum of Series 1/1 + 1/2 + … + 1/N21. Print Multiplication Series22. Print Pyramid Pattern23. Print Inverted Pyramid Pattern24. Print Floyd's Triangle25. Print Pascal's Triangle

Loop Programs

  1. 01Print Numbers 1–100
  2. 02Print Even Numbers in Range
  3. 03Print Odd Numbers in Range
  4. 04Sum of Digits
  5. 05Reverse Digits of a Number
  6. 06Calculate Factorial (Loop)
  7. 07Fibonacci Series
  8. 08Palindrome Number Check
  9. 09Count Digits in a Number
  10. 10GCD of Two Numbers (Loop)
  11. 11LCM of Two Numbers (Loop)
  12. 12Print Prime Numbers in Range
  13. 13Count Prime Numbers in Range
  14. 14Check Composite Number
  15. 15Power of 2 Checker
  16. 16Print Number Pattern
  17. 17Print Star Pattern
  18. 18Armstrong Numbers in Range
  19. 19Strong Numbers in Range
  20. 20Sum of Series 1/1 + 1/2 + … + 1/N
  21. 21Print Multiplication Series
  22. 22Print Pyramid Pattern
  23. 23Print Inverted Pyramid Pattern
  24. 24Print Floyd's Triangle
  25. 25Print Pascal's Triangle

Print Odd Numbers in Range in Python

Print all odd numbers between 1 and a given upper limit.

BeginnerLoop ProgramsExample 3 of 25
print-odd-numbers-in-range.py
Run in browser
1# Program to print odd numbers up to N
2
3n = int(input("Enter upper limit: "))
4
5for i in range(1, n + 1, 2):
6 print(i)

Output

Enter upper limit: 10
1
3
5
7
9

What's going on

We start from 1 and step by 2 with range(1, n + 1, 2) to generate all odd numbers <= n.

PreviousPrint Even Numbers in RangeNextSum of Digits

On this page

CodeOutputExplanation
Up nextSum of Digits
Schoolabe

Learn, Practice, Ace Coding

ProgramsCompaniesTutorialsQuizInterview PrepCareer QuestGATE CS prepGATE CS 2027 study planJob Ready
AboutContactCareersBlog
DocumentationAPI ReferenceCommunitySupport
Privacy PolicyTermsRefund PolicyCookie Policy

© 2026 Schoolabe