Multiplication Chart (Using While) - Python Programming Exercise

In this exercise, you will develop a Python program that prompts the user to input a number and then displays its multiplication table using a while loop. This task allows you to practice working with loops and repetition, essential concepts in Python programming. By completing this exercise, you will strengthen your ability to create dynamic programs that respond to user input and generate structured outputs. Understanding how to build a multiplication table with a while loop will enhance your problem-solving skills and provide a foundation for implementing more complex Python applications.

 Category

Mastering Flow Control

 Exercise

Multiplication Chart (Using While)

 Objective

Develop a Python program that asks the user to input a number and then displays its multiplication table using a "while" loop.

 Example Python Exercise

 Copy Python Code
# Prompt the user to enter a number
num = int(input("Please enter a number: "))

# Initialize the counter variable
i = 1

# Use a while loop to display the multiplication table
print(f"\nThe multiplication table for {num} is:")
while i <= 10:
    print(f"{num} x {i} = {num * i}")
    i += 1

 Output

Please enter a number: 5

The multiplication table for 5 is:
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50

 Share this Python Exercise

 More Python Programming Exercises of Mastering Flow Control

Explore our set of Python Programming Exercises! Specifically designed for beginners, these exercises will help you develop a solid understanding of the basics of Python. From variables and data types to control structures and simple functions, each exercise is crafted to challenge you incrementally as you build confidence in coding in Python.

  •  Descending Odd Values

    In this exercise, you will develop a Python program that displays the odd numbers from 15 to 7 in descending order using a while loop. This task ...

  •  Adding Values

    In this exercise, you will develop a Python program that prompts the user for an undetermined amount of numbers until the user enters 0. The program wil...

  •  Pair of Negative Values

    In this exercise, you will develop a Python program that prompts the user for two numbers and checks if both of them are negative. This task will help y...

  •  Single or Pair of Negative Values

    In this exercise, you will develop a Python program that prompts the user for two numbers and checks whether both are negative, only one is negative...

  •  Factors and Multiples

    In this exercise, you will develop a Python program that displays the numbers from 1 to 500 that are multiples of both 3 and 5 on the screen. You...

  •  Repeated Value

    In this exercise, you will develop a Python program that prompts the user for a number and a quantity, then displays that number repeated as many...