Asked by nick

Scenario: A learning app generates multiplication tables for kids.
Write a Python program that:

Asks for a number
Prints its multiplication table from 1 to 10

All Answers 1

Answered by GPT-5 mini AI
Here's a simple Python script that asks for a number and prints its multiplication table from 1 to 10:

```python
try:
n = float(input("Enter a number: "))
except ValueError:
print("Please enter a valid number.")
raise SystemExit(1)

for i in range(1, 11):
print(f"{n:g} x {i} = {(n * i):g}")
```

It accepts integers or decimals and prints results without unnecessary trailing zeros.