25 XP

13. Times table

Beginner loops input

Your program reads one line holding a whole number n. Print its times table: ten lines, multiplying n by 1, then by 2, and so on up to 10.

Write each line in exactly this form: 7 x 3 = 21. That is the number, a space, a lower-case x, a space, the multiplier, a space, =, a space, and the result. A negative n keeps its minus sign, and 0 works the same way.

Example 1

Input7
Output7 x 1 = 7 7 x 2 = 14 7 x 3 = 21 7 x 4 = 28 7 x 5 = 35 7 x 6 = 42 7 x 7 = 49 7 x 8 = 56 7 x 9 = 63 7 x 10 = 70
Explanation7 times each number from 1 to 10.

Example 2

Input-2
Output-2 x 1 = -2 -2 x 2 = -4 -2 x 3 = -6 -2 x 4 = -8 -2 x 5 = -10 -2 x 6 = -12 -2 x 7 = -14 -2 x 8 = -16 -2 x 9 = -18 -2 x 10 = -20
ExplanationThe minus sign stays: -2 x 3 = -6.

Constraints

  • n is a whole number from -100 to 100.
  • Print nothing else. A prompt inside input() is fine: the tests leave it out of the output.

Submit also runs 4 more tests you can't see.

Practises For Loops (lesson 13).

Code
# Read a whole number n and print its times table,
# from "n x 1 = ..." to "n x 10 = ...".
n = int(input())