a = input(“Enter the number: “)
print(f”Multiplication table of {a} is: “)
for i in range(1, 11):
print(f”{a} X {i} = {a*i}”)
I know here I am trying to multiply string with integer so Python should throw an error instead it is giving me this ouput
Enter the number: 7
Multiplication table of 7 is:
7 X 1 = 7
7 X 2 = 77
7 X 3 = 777
7 X 4 = 7777
7 X 5 = 77777
7 X 6 = 777777
7 X 7 = 7777777
7 X 8 = 77777777
7 X 9 = 777777777
7 X 10 = 7777777777
Explain this ouput??
submitted by /u/FewNectarine623
[link] [comments]
r/learnpython a = input(“Enter the number: “) print(f”Multiplication table of {a} is: “) for i in range(1, 11): print(f”{a} X {i} = {a*i}”) I know here I am trying to multiply string with integer so Python should throw an error instead it is giving me this ouput Enter the number: 7 Multiplication table of 7 is: 7 X 1 = 7 7 X 2 = 77 7 X 3 = 777 7 X 4 = 7777 7 X 5 = 77777 7 X 6 = 777777 7 X 7 = 7777777 7 X 8 = 77777777 7 X 9 = 777777777 7 X 10 = 7777777777 Explain this ouput?? submitted by /u/FewNectarine623 [link] [comments]
a = input(“Enter the number: “)
print(f”Multiplication table of {a} is: “)
for i in range(1, 11):
print(f”{a} X {i} = {a*i}”)
I know here I am trying to multiply string with integer so Python should throw an error instead it is giving me this ouput
Enter the number: 7
Multiplication table of 7 is:
7 X 1 = 7
7 X 2 = 77
7 X 3 = 777
7 X 4 = 7777
7 X 5 = 77777
7 X 6 = 777777
7 X 7 = 7777777
7 X 8 = 77777777
7 X 9 = 777777777
7 X 10 = 7777777777
Explain this ouput??
submitted by /u/FewNectarine623
[link] [comments]