Floyd Triangle
Print Floyd triangle pattern.
IntermediatePhase 2 - Level 4: Pattern PrintingExample 10 of 13
floyd-triangle.py
1# Take n2n = int(input("Enter number of rows: "))34# Print Floyd triangle5num = 16for i in range(1, n + 1):7 for j in range(1, i + 1):8 print(num, end=" ")9 num += 110 print()
Output
Enter number of rows: 4 1 2 3 4 5 6 7 8 9 10
What's going on
Print consecutive numbers in rows.
Key Concepts:
Use counter variable
Increment after each print
Different numbers per row
🔗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