Print Numbers from 10 Down to 1
Print numbers from 10 down to 1.
BeginnerPhase 2 - Level 1: Basic LoopingExample 6 of 14
print-numbers-from-10-down-to-1.py
1# Print numbers 10 to 12for i in range(10, 0, -1):3 print(i)
Output
10 9 8 7 6 5 4 3 2 1
What's going on
Use range with negative step.
Key Concepts:
range(10, 0, -1) counts backwards
Start: 10, End: 0 (exclusive), Step: -1
Prints 10, 9, 8, ..., 1
🔗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