Created
April 5, 2017 12:03
-
-
Save Chinmaytare/04a3aec50976e91abdcb6cfcd45baf31 to your computer and use it in GitHub Desktop.
Printing a list of multiplication table for any given number (in a python list form)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = int(input("Enter a number to get its multiplication table: ")) | |
z = int(input("Table upto?: ")) | |
running = True | |
while running: | |
table = [[x, y, x * y] for y in range(1, z+1)] | |
for i in table: | |
print(i) | |
continue | |
print("Done.") | |
running = False | |
# Enter a number to get its multiplication table: 6 | |
# Table upto?: 10 | |
# Output: | |
# [6, 1, 6] | |
# [6, 2, 12] | |
# [6, 3, 18] | |
# [6, 4, 24] | |
# [6, 5, 30] | |
# [6, 6, 36] | |
# [6, 7, 42] | |
# [6, 8, 48] | |
# [6, 9, 54] | |
# [6, 10, 60] | |
# Done. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment