Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiplication Table
#4
Hi there :)

I am trying to add numbers in a line, and was looking for help.

size = input("Enter number: ")
size = int(size)

step = 1
number = 1
ran = 1
while number < size:
    for x in range(ran, size + 1, step)
        print((str(ran)+"|"), x)
        number += 1
        ran += 1
        step += 1
This is my code atm and here is the output:
Output:
Enter number: 5 1| 1 2| 2 3| 3 4| 4 5| 5
What I want to do is to make 5 lines (or whatever number the user inputs) along each column, So that it will create a kind of multiplication table. Like so:

Output:
Enter number: 5 1| 1 2 3 4 5 2| 2 4 6 8 10 3| 3 6 9 12 15 4| 4 8 12 16 20 5| 5 10 15 20 25
Any ideas?
Reply


Messages In This Thread
Multiplication Table - by funnybone04 - Apr-07-2018, 11:09 PM
RE: Multiplication Table - by nilamo - Apr-07-2018, 11:25 PM
RE: Multiplication Table - by funnybone04 - Apr-08-2018, 12:07 AM
RE: Multiplication Table - by nilamo - Apr-08-2018, 03:03 AM
Adding numbers in a line - by funnybone04 - Apr-08-2018, 12:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  If statements and multiplication elroberto 1 1,753 Jun-22-2022, 05:35 PM
Last Post: deanhystad
  Find the maximum multiplication ercv 3 2,199 Nov-30-2020, 11:55 AM
Last Post: DeaD_EyE
  Multiplication Table Homework mcnhscc39 6 4,691 Nov-25-2018, 04:01 PM
Last Post: mcnhscc39
  creating a 3x3 multiplication table aditvaddi 1 3,653 Jun-18-2018, 06:05 AM
Last Post: volcano63
  Nested Loop multiplication table SushiRolz 3 10,277 Feb-28-2018, 04:34 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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