Number Pattern 2
Print number pattern: 1, 22, 333, ...
IntermediatePhase 2 - Level 4: Pattern PrintingExample 5 of 13
number-pattern-2.py
1# Take n2n = int(input("Enter number of rows: "))34# Print pattern5for i in range(1, n + 1):6 for j in range(1, i + 1):7 print(i, end="")8 print()
Output
Enter number of rows: 4 1 22 333 4444
What's going on
Print row number i times.
Key Concepts:
Outer loop: rows
Inner loop: print i, i times
Same number repeated
🔗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