Write a Python program that asks the user to enter a number and then the number of rows for the multiplication table. Use a for loop with an else clause to print the multiplication table. If the number of rows entered by the user is 10 or less, print the multiplication table up to the given rows. If the number of rows is more than 10, print the table only up to 10 rows and then print "rows are limited to 10" using the else clause. Each line should be printed in the format: number x i = result. The program must take both the number and the number of rows as input from the user.
Examples
Example 1
Input
9
11
Output
9 x 1 = 9
9 x 2 = 18
9 x 3 = 27
9 x 4 = 36
9 x 5 = 45
9 x 6 = 54
9 x 7 = 63
9 x 8 = 72
9 x 9 = 81
9 x 10 = 90
rows are limited to 10
Explanation 11 rows are requested but limit is 10 so table is printed only up to 10 rows and error message is shown
Example 2
Input
5
3
Output
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
Explanation 3 rows are within limit so table is printed up to 3 rows without any error message
Example 3
Input
7
10
Output
7 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
Explanation 10 rows are exactly at limit so table is printed up to 10 rows without any error message
Acceptance—
Accepted0
Submissions0
Auto-save
SavedLn 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
9 x 1 = 9
9 x 2 = 18
9 x 3 = 27
9 x 4 = 36
9 x 5 = 45
9 x 6 = 54
9 x 7 = 63
9 x 8 = 72
9 x 9 = 81
9 x 10 = 90
rows are limited to 10
No results yet
Run your code to test it against the sample cases.