You can download this code by clicking the button below.
This code is now available for download.
This function creates a randomly filled table and displays it using the Rich library's Table class.
Technology Stack : Rich, Table, random
Code Type : The type of code
Code Difficulty : Intermediate
def display_random_table(rows, columns):
from rich.table import Table
from random import randint
table = Table(show_header=True, header_style="bold magenta")
for _ in range(rows):
row = [randint(1, 100) for _ in range(columns)]
table.add_row(*row)
return table