30 Day code challenge-python
Day 5— Loops
Task
Given an integer, n, print its first 10 multiples. Each multiple n * i (where 1≤ i ≤ 10) should be printed on a new line in the form: n x i = result
.
Input Format
A single integer, n.
Output Format
Print 10 lines of output; each line i (where 1≤ i ≤ 10 ) contains the result of n x i
in the form:n x i = result
.
Explanation
Line 1: Gets input from the user
Line 2: for loop is generated to multiply the value of the input from 1 to 10
Line 3: Finally, based on the output format the value is printed. Since we can only add strings, int values are type casted to string
Bonus Tip: We can also step through even and odd values of i eg: range(1, 11, 2) gives only the even values.
See you on day 6