Python Forum
multiplication table
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
multiplication table
#1
i was looking at a copy of an old multiplication table. the top row had 1 through 9. the left column had 1 through 9. the lowest product is 1. the highest product is 81. there are 81 products in the table. the sum of all these products is what? how many people can write Python code to find that sum?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Here is my code
print( (9 * (9 + 1) // 2) ** 2 )
Ahah! Interesting output!
« We can solve any problem by introducing an extra level of indirection »
Reply
#3
I'm pretty stupid but I tried
sum = 0

for a in range(1, 9):
    for b in range(1, 9):
        sum += (a * b) / 9

print(sum)
I got 144.0
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020