filmov
tv
How to write a multiplication table in Python with While loop

Показать описание
To create a multiplication table in Python using a `while` loop, follow these steps:
1. **Initialize a Counter**: Define a variable to start counting from 1.
2. **Set a Condition**: Use a `while` loop to specify how long the loop should run (e.g., up to 10).
3. **Print the Multiplication Result**: Multiply the counter by a fixed number (e.g., `num * i`) and print the output.
4. **Increment the Counter**: Increase the counter inside the loop to prevent an infinite loop.
1. **Initialize a Counter**: Define a variable to start counting from 1.
2. **Set a Condition**: Use a `while` loop to specify how long the loop should run (e.g., up to 10).
3. **Print the Multiplication Result**: Multiply the counter by a fixed number (e.g., `num * i`) and print the output.
4. **Increment the Counter**: Increase the counter inside the loop to prevent an infinite loop.