A simple Python program that allows users to generate multiplication tables for a base number, with customizable rows. After each table is generated, the user is prompted whether they'd like to create another one.
- Allows the user to specify both positive and negative base numbers.
- Ensures the user specifies at least one row for the multiplication table.
- Uses a
whileloop to iterate through each row and calculate the multiplication results dynamically. - Provides an option to generate additional tables.
- Cleanly formatted output for easy readability.
- Input Validation:
- The program uses
pyinputplusto validate inputs for the base number and the maximum number of rows. - The
max_row_numberinput has a minimum constraint of 1 to ensure the table has at least one row.
- The program uses
- Calculation and Output:
- A
whileloop iterates from 1 to the specifiedmax_row_number. - For each iteration, the program calculates the result by multiplying the base number by the current row number and prints the result in the format:
base_number X row_counter = result.
- A
- User Interaction:
- After generating a table, the user is prompted to decide whether they want to create another table or exit the program.
- Python 3.13.1
pyinputpluslibrary
- Clone this repository or download the program file.
- Ensure you have Python 3.13.1 installed on your system.
- Install
pyinputplusby running:pip install pyinputplus
- Run the program using the command:
python Multiplication_Table_Generator.py
- Enter the base number (positive or negative) when prompted.
- Enter the maximum number of rows for the table (minimum value: 1).
- View the generated multiplication table in the terminal.
- Decide whether to create another table or exit the program when prompted.
What is the base number you would like to generate a multiplication table for? -3
What is the maximum amount of rows you would like to generate? 5
-3 X 1 = -3
-3 X 2 = -6
-3 X 3 = -9
-3 X 4 = -12
-3 X 5 = -15
Would you like to create another multiplication table? (y/n) y
What is the base number you would like to generate a multiplication table for? 4
What is the maximum amount of rows you would like to generate? 3
4 X 1 = 4
4 X 2 = 8
4 X 3 = 12
Would you like to create another multiplication table? (y/n) n
Thank you for using the Multiplication Table Generator! Goodbye!
- Add an option to save the table to a text file.
- Add an option to customize the range (e.g., start and end numbers) for the table.
This project is licensed under the MIT License.