Print Numbers from 1 to 10
Print numbers from 1 to 10 using a loop.
BeginnerPhase 2 - Level 1: Basic LoopingExample 1 of 14
print-numbers-from-1-to-10.py
1# Print numbers 1 to 102for i in range(1, 11):3 print(i)
Output
1 2 3 4 5 6 7 8 9 10
What's going on
Use for loop with range function.
Key Concepts:
range(1, 11) generates numbers from 1 to 10Loop variable
i takes each valuePrint each value in the loop
🔗Related Content
- 📖
Phase 2 - Learn Concepts
Review Phase 2 concepts and explanations
- 📝
Phase 2 - Quiz
Test your Phase 2 understanding with quiz questions
- 💻
Phase 2 - All Practice Problems
Explore all practice problems for Phase 2
- 🎓
Master Your Logic Building - Complete Course
Browse all phases and tutorials
- 🧠
Logic Building Overview
Learn about the complete logic building curriculum