You can use a for loop and join a list comprehension for each row to print your table.

for i in range(0, 50, 10):
    print(' '.join([str(j) for j in range(i, i + 10)]))

Similarly, you can unpack a row as a list into the print method's parameters.

for i in range(0, 50, 10):
    print(*[j for j in range(i, i + 10)])
Answer from tdurnford on Stack Overflow
🌐
Programiz
programiz.com › python-programming › examples › multiplication-table
Python Program to Display the multiplication Table
Our visualizer shows how loops generate each row, one calculation at a time. Try it yourself! # Multiplication table (from 1 to 10) in Python num = 12 # To take input from the user # num = int(input("Display multiplication table of? ")) # Iterate 10 times from i = 1 to 10 for i in range(1, 11): print(num, 'x', i, '=', num*i)
Discussions

printing - Is it possible to print a table of a 'for loop' at the same position without moving ahead the lines of the Terminal using python? - Stack Overflow
Here is a code example to print some numbers at the same cursor position of the console, without moving the characters from place. Code Example from sys import stdout from time import sleep for i in More on stackoverflow.com
🌐 stackoverflow.com
October 7, 2020
python - How to print table in looping pyhton console - Stack Overflow
I want to print a table on my console. From now am using pandas how to print using tabulate Here is my Source code: from numpy import average import pandas as pd z = 10119011 a = 17 c = 43 m = 499... More on stackoverflow.com
🌐 stackoverflow.com
python - How to print a multiplication table using for loop? - Stack Overflow
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). Expected output: 1 2 3 2 4 6... More on stackoverflow.com
🌐 stackoverflow.com
for loop - Print a multiplication table in Python - Stack Overflow
How to print a multiplication table in python in which the number must be defined by the user and print the table up to a maximum of 20 rows. Even if the number of rows asked by the user is more th... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Medium
medium.com › @harshitbasti › printing-table-in-python-by-nesting-for-and-while-loops-7cff305aeeaa
Printing table in python by nesting for and while loops | by Harshit Singh | Medium
June 29, 2024 - table_of =[1,2,3,4,5,6,7, 8, 9, 10] for i in table_of: a=i x = 1 while x<=10: print(x*a , end = " ") x= x+1 print() This code also generates a multiplication table for the values 1 to 10, but it does so using a while loop instead of a nested ...
🌐
Tutorial Gateway
tutorialgateway.org › python-program-to-print-multiplication-table
Python Program to Print Multiplication Table
August 30, 2018 - The first for loop iterates from 8 to 10 to print the table of 8 and 9. The nested for loop iterates from 1 to 10 and generates the table. for i in range(8, 10): for j in range(1, 11): print('{0} * {1} = {2}'.format(i, j, i*j)) print('==============') Multiplication Table output. This Python program allows users to enter any integer value.
🌐
BeginnersBook
beginnersbook.com › 2018 › 06 › python-program-print-multiplication-table
Python Program to Print Multiplication Table of a given Number
The loops run from 1 to 10 and ... num = int(input("Enter the number: ")) print("Multiplication Table of", num) for i in range(1, 11): print(num,"X",i,"=",num * i)...
🌐
Stack Overflow
stackoverflow.com › questions › 64238397 › is-it-possible-to-print-a-table-of-a-for-loop-at-the-same-position-without-mov
printing - Is it possible to print a table of a 'for loop' at the same position without moving ahead the lines of the Terminal using python? - Stack Overflow
October 7, 2020 - When printing a table on console the headers of the table must not change, but the values (row elements) passed must dynamically change at the same cell positions, iterating the values passed. Below is the code I aimed for. from prettytable import PrettyTable from sys import stdout from time import sleep t = PrettyTable(['Name', 'Age']) lis = [['Alice', 25],['Alice', 20],['Man', 20]] for x in lis: t.add_row(x) print(t, end='\r') t.clear_rows() sleep(1) stdout.write("\n")
Find elsewhere
🌐
PYnative
pynative.com › home › python › programs and examples › create multiplication table in python
Create Multiplication Table in Python
March 27, 2025 - In this tutorial, we will explore various ways to create and display multiplication tables using Python. Print the multiplication table for a specific number using for loop · Print Full Multiplication Table Using Nested Loops ... This method is straightforward and uses a single for loop to print the multiplication table for a specific number.
Top answer
1 of 1
1

If you use tabulate, you need to pass your dataframe df as main argument and specify its keys:

from numpy import average
import pandas as pd
from tabulate import tabulate

z = 10119011
a = 17
c = 43
m = 499

for i in range(0, 21):
    LCG = ((a*z)+c) % m
    z = LCG
    u = z/m
    hasil = 700 + u * (1500-700+1)

    d = {
        'Random Number Integer': [z],
        'Uniform Random Number': [u],
        'Penggunaan Pertamax/hari': [hasil]
    }
    df = pd.DataFrame(data=d)
    print(tabulate(df, headers='keys'))

Output:

      Random Number Integer    Uniform Random Number    Penggunaan Pertamax/hari
--  -----------------------  -----------------------  --------------------------
 0                      465                 0.931864                     1446.42
      Random Number Integer    Uniform Random Number    Penggunaan Pertamax/hari
--  -----------------------  -----------------------  --------------------------
 0                      463                 0.927856                     1443.21
      Random Number Integer    Uniform Random Number    Penggunaan Pertamax/hari
--  -----------------------  -----------------------  --------------------------
 0                      429                 0.859719                     1388.64
      Random Number Integer    Uniform Random Number    Penggunaan Pertamax/hari
--  -----------------------  -----------------------  --------------------------
 0                      350                 0.701403                     1261.82
      Random Number Integer    Uniform Random Number    Penggunaan Pertamax/hari
--  -----------------------  -----------------------  --------------------------
 0                        5                  0.01002                     708.026
      Random Number Integer    Uniform Random Number    Penggunaan Pertamax/hari
--  -----------------------  -----------------------  --------------------------
 0                      128                 0.256513                     905.467
      Random Number Integer    Uniform Random Number    Penggunaan Pertamax/hari
--  -----------------------  -----------------------  --------------------------
.....
🌐
Toppr
toppr.com › guides › python-guide › examples › python-examples › decision-making-and-loops › multiplication-table › python-program-to-display-the-multiplication-table
Program to Display the Python Multiplication Table: Examples
July 19, 2021 - Copy Code Copied Use a different Browser · numb = int(input(" Enter a number : ")) # using the for loop to generate the multiplication tables print("Table of: ") for a in range(1,11): print(num,'x',a,'=',num*a) Output Enter the number : 7 ...
🌐
Scaler
scaler.com › home › topics › multiplication table in python
Python Program to Display the Multiplication Table - Scaler Topics
February 9, 2024 - Let us understand by the below ... us print the multiplication table of 4. We first ask the user to input the number for which we want the table to be printed, and then we iterate it ten times by range() function in for loop....
🌐
Stack Overflow
stackoverflow.com › questions › 60521018 › how-to-print-a-multiplication-table-using-for-loop
python - How to print a multiplication table using for loop? - Stack Overflow
You also have misplaced the +1, which gets you the wrong start and (with range) not enough lines. Since you second loop works satisfyingly, just use the same pattern for the first loop. 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)
🌐
Stack Overflow
stackoverflow.com › questions › 76698063 › print-a-multiplication-table-in-python
for loop - Print a multiplication table in Python - Stack Overflow
Here's the modified code: Copyx = int(input("Enter the number for the multiplication table: ")) y = int(input("Enter the number of rows for the multiplication table: ")) for i in range(1, y + 1): result = x * i print(f"{x} * {i} = {result}") if i ...
🌐
FavTutor
favtutor.com › blogs › multiplication-table-python
How to Create Multiplication Table in Python? (loop, list, lambda)
November 12, 2022 - ... # Program: Multiplication Table ... it 10 times print("The multiplication table of ", num) for i in range(1, 11): print(f" {num} x {i} = {num*i}")...
Top answer
1 of 1
1

i'd like to uses pandas when i want get the table format:
for example:

from Bio import SeqIO
import pandas as pd


def same_seq(a_record, brecord):
    window_size = 5
    step_size = 1
    for j in range(0, len(a_record.seq) - window_size + 1):
        for k in (a_record.seq.reverse_complement()[j: j + 5].split()):
            return brecord.seq.find(k) != -1


if __name__ == '__main__':
    records = list(SeqIO.parse("file1.fa", "fasta"))
    target_records = list(SeqIO.parse("file2.fa", "fasta"))
    rows_list = []
    for target_record in target_records:
        new_row = {'name': target_record.name}
        for record in records:
            if same_seq(record, target_record):
                new_row[record.name] = 1
            else:
                new_row[record.name] = 0
        rows_list.append(new_row)
    df = pd.DataFrame(rows_list)
    df = df.set_index(["name"])
    print(df)

      seq1  seq2
name            
seq3     1     0
seq9     0     0

if you wana change the compare of seq:
you should use seq[j: j+5].reverse_complement() but seq.reverse_complement()[j: j+5] I'm not sure if I understand it right
file1.fa

>seq1
ACCGG
>seq2
AATTTC
>seqtest1
NNNACCGTGCNN

file1.fa

>seq1
ACCGG
>seq2
AATTTC
>seqtest1
NNNACCGTGCNN

file2.fa

>seq3
CCGGT
>seq9
GGGGGGCCC
>seqtest2
NNCACGGTNN
from Bio import SeqIO
import pandas as pd



def same_seq_window(a_record, b_record, window_size):
    for i in range(len(a_record.seq)- window_size + 1):
        a_seq = a_record.seq[i: i + window_size]
        if b_record.seq.find(a_seq.reverse_complement()) != -1:
            return True
    return False

def same_seq(a_record, b_record):
    window_sizes = range(5, len(a_record.seq)+1)
    for window_size in window_sizes:
        if same_seq_window(a_record, b_record, window_size):
            return True
    return False

if __name__ == '__main__':
    records = list(SeqIO.parse("file1.fa", "fasta"))
    target_records = list(SeqIO.parse("file2.fa", "fasta"))
    rows_list = []
    for target_record in target_records:
        new_row = {'name': target_record.name}
        for record in records:
            if same_seq(record, target_record):
                new_row[record.name] = 1
            else:
                new_row[record.name] = 0
        rows_list.append(new_row)
    df = pd.DataFrame(rows_list)
    df = df.set_index(["name"])
    print(df)

          seq1  seq2  seqtest1
name                          
seq3         1     0         0
seq9         0     0         0
seqtest2     0     0         1
🌐
Vultr
docs.vultr.com › python › examples › display-the-multiplication-table
Python Program to Display the multiplication Table | Vultr Docs
November 22, 2024 - Here's a simple Python program ... {num}\n") # Loop from 1 to 10 to generate the table for i in range(1, 11): print(f"{num} x {i} = {num * i}") Explain Code...