In this Python code tutorial, you will learn how to display the multiplication table of any number. Before moving ahead, please ensure that you have a basic knowledge of the following concepts:
- Python syntax
- Variables and operators
- For loop
Before moving ahead, you must check these resources for Python beginners:
- 10 Best Books To Learn Python For Beginners And Experts
- Learn Python Online With These 12 Best Free Websites
- 10 Best Udemy Python Courses for Beginners
Other Python code examples you should check:
- Python Program To Check If a Number is Odd or Even
- Python Program To Check Prime Number
- Python 3 Program To Multiply Two Matrices
- Python 3 Program To Add Two Matrices
- Python 3 Program to Check Armstrong Number
Python Program To Display Multiplication Table of Any Number
Let’s now see the code to display the multiplication table of any number.
Code:
numtable = int(input("Enter the number whose multiplication table you want to display: ")) for i in range(1, 11): print(numtable, 'x', i, '=', numtable*i)
In this code, we will take input from users and save it numtable variable. After that, we will use the for loop to range between 1 to 10 using the range() function and print the multiplication table of the specified number.
Output:
Enter the number whose multiplication table you want to display: 23
23 x 1 = 23
23 x 2 = 46
23 x 3 = 69
23 x 4 = 92
23 x 5 = 115
23 x 6 = 138
23 x 7 = 161
23 x 8 = 184
23 x 9 = 207
23 x 10 = 230
Must check Python programming tutorials:
- Sending Emails Using Python With Image And PDF Attachments
- How To Automate Google Search With Python
- How To Create Keylogger In Python
- How To Make A Digital Clock In Python Using Tkinter
- Python App Development Scope—Everything You Should Know
- 7 Best Python IDE for Windows [Code Editors]
- 10 Best Python Frameworks for Web Development
- 11 Best Python Libraries for Machine Learning
- 15 Best Python Libraries for Data Science and Analysis
- 10 Best Python Libraries for Image Processing
- Free SEO Rank Tracking Software Download: KWchecker by CodeItBro
- Working With Python 3 Lists | Learn By Examples
Hello Friends! I am Himanshu, a hobbyist programmer, tech enthusiast, and digital content creator.
With CodeItBro, my mission is to promote coding and help people from non-tech backgrounds to learn this modern-age skill!