Chapter 7 Useful Built-in Functions
7.2 The input() Function
input() pauses an interactive program and returns the user’s response as a
string. Convert it explicitly when a numeric value is required:
Book builds are non-interactive, so the runnable multiplication-table example uses a fixed value:
number = 5
for multiplier in range(1, 11):
product = multiplier * number
print(multiplier, "x", number, "=", product)## 1 x 5 = 5
## 2 x 5 = 10
## 3 x 5 = 15
## 4 x 5 = 20
## 5 x 5 = 25
## 6 x 5 = 30
## 7 x 5 = 35
## 8 x 5 = 40
## 9 x 5 = 45
## 10 x 5 = 50