How to use 'python program to print multiplication table from 1 to 10' in Python

Every line of 'python program to print multiplication table from 1 to 10' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
34def multiplication(one_num, two_num):
35 total = 0
36 other_count = 0
37
38 # Find bigger number in order to set length of both numbers
39 if len(one_num) >= len(two_num):
40 longer = one_num
41 shorter = two_num
42 else:
43 longer = two_num
44 shorter = one_num
45
46 # Add zeroes to the front of the smaller number until lengths are equal.
47 for i in range(len(longer) - len(shorter)):
48 shorter = '0' + shorter
49
50 for i in range(len(shorter) - 1, -1, -1):
51 count = 0
52 for j in range(len(longer) - 1, -1, -1):
53 big_num = longer[j] + ('0' * count)
54 product = int(big_num) * int(shorter[i] + '0' * other_count)
55 total += product
56 count += 1
57 other_count += 1
58 print(str(one_num) + ' * ' + str(two_num) + ' = ' + str(total))

Related snippets