Print Multiplication Table
Print the table of a given number (n × 1 to n × 10).
BeginnerPhase 2 - Level 1: Basic LoopingExample 7 of 14
print-multiplication-table.py
1# Take n as input2n = int(input("Enter a number: "))34# Print multiplication table5print(f"Multiplication table of {n}:")6for i in range(1, 11):7 result = n * i8 print(f"{n} × {i} = {result}")
Output
Enter a number: 5 Multiplication table of 5: 5 × 1 = 5 5 × 2 = 10 5 × 3 = 15 ... 5 × 10 = 50
What's going on
Loop from 1 to 10, multiply n by each.
Key Concepts:
Loop variable i from 1 to 10
Calculate n * i for each iteration
Print formatted result
🔗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