Created
December 20, 2020 06:11
-
-
Save ayubmetah/25dbad310b5462220e2df40d2c83a279 to your computer and use it in GitHub Desktop.
Multiplication table in Python
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
#This function prints out a multiplication table (where each number is the result of multiplying the first number of its row by the number at the top of its column). Fill in the blanks so that calling multiplication_table(1, 3) will print out: | |
#1 2 3 | |
#2 4 6 | |
#3 6 9 | |
def multiplication_table(start, stop): | |
for x in range(start,stop+1): | |
for y in range(start,stop+1): | |
print(str(x*y), end=" ") | |
print() | |
multiplication_table(1, 10) | |
# Should print the multiplication table shown above. |
def multiplication_table(start, stop):
for x in range(start, stop+1):
for y in range(start, stop+1):
print(str(x*y), end=" ")
print()
multiplication_table(1, 3)
Should print the multiplication table shown above
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def multiplication_table(start, stop):
for x in range(start+2):
x = x + 1
for y in range(stop):
y = y +1
print(str(x*y), end=" ")
multiplication_table(1, 3)
Should print the multiplication table shown above