Skip to main content

Print Multiplication Tables in Python

# -*- coding: utf-8 -*-

#Created on Sat Sep 21 10:24:49 2019

# @author: MEGHA


m = int(input("How many tables you want to print?"))

n = int(input("How many tables you want to print in each row?"))

p = int(input("How many terms you want in each table?" ))

print ("\nThe MultiPlication Tables are")

print ("****************************** ")

for x in range (1,m,n):

    for y in range (1,p+1):

        for z in range (1,n+1,1) :

            if x+z-1 <= m :

                print (str(y) + " * " +str( x+z-1) + " = "+str(y*(x+z-1)), end = "\t ")

        print("")

    print("")

# end


Result:

How many tables you want to print?15

How many tables you want to print in each row?5

How many terms you want in each table?2

The MultiPlication Tables are

****************************** 

1 * 1 = 1         1 * 2 = 2         1 * 3 = 3          1 * 4 = 4          1 * 5 = 5  

2 * 1 = 2         2 * 2 = 4         2 * 3 = 6         2 * 4 = 8          2 * 5 = 10  


1 * 6 = 6          1 * 7 = 7         1 * 8 = 8         1 * 9 = 9         1 * 10 = 10  

2 * 6 = 12 2 * 7 = 14 2 * 8 = 16 2 * 9 = 18 2 * 10 = 20  


1 * 11 = 11 1 * 12 = 12 1 * 13 = 13 1 * 14 = 14 1 * 15 = 15  

2 * 11 = 22 2 * 12 = 24 2 * 13 = 26 2 * 14 = 28 2 * 15 = 30


Comments

Popular posts from this blog

ORACLE Express Edition: Getting Started

1. Introduction to Oracle Database 21c Express Edition (XE) - Free, lightweight version of Oracle Database - Ideal for learning and small-scale applications - Limited to 12GB of user data and uses up to 2GB of RAM 2. Installation and Setup 2.1 Installing Oracle 21c XE 1. Download Oracle 21c XE from: https://www.oracle.com/database/technologies/xe-downloads.html 2. Run the installer:    - Windows: Double-click the .exe file    - Linux: Use `rpm` or `yum` command 3. Follow the installation wizard:  Accept the license agreement Choose an installation location (default is usually fine) Set a password for the SYS, SYSTEM, and PDBADMIN accounts (write this down!) Select the option to start the database service automatically (recommended)  4. Complete the installation: Wait for the installation process to finish Note down the database connection details provided at the end The default container database (CDB) name is XE The default pluggable database (PDB) nam...

Types of DBMS

 DBMS Types Hierarchical DBMS: Structure: Data organized in a tree-like structure with parent-child relationships. Example: IBM's Information Management System (IMS) Use case: Organizational charts, file systems Imagine a family tree: Grandparent Parent 1 Child 1 Child 2 Parent 2 Child 3 Network DBMS: Structure: Data organized in a graph-like structure allowing many-to-many relationships. Example: Integrated Data Store (IDS) Use case: Complex relationship modeling Think of a social network: Person A is friends with Person B and Person C Person B is friends with Person A and Person D Person C is friends with Person A and Person D Relational DBMS: Structure: Data organized in tables with rows and columns, using relationships between tables. Examples: MySQL, Oracle, PostgreSQL Use case: Most common type, used in various applications Imagine a library system: Books table: (ID, Title, Author, ISBN) Members table: (ID, Name, Address, Phone) Loans table...

Key Terminologies used in Relational Database

 1. Database Definition: A database is a structured collection of data stored and managed electronically. It allows for efficient data retrieval, manipulation, and management. Characteristics: - Structured : Data is organized in tables with rows and columns. - Persistent: Data remains available over time. - Accessible : Allows querying and manipulation through a Database Management System (DBMS). 2. Database Management System (DBMS) Definition: A DBMS is software that facilitates the creation, manipulation, and management of databases. It provides an interface for users and applications to interact with the data. Characteristics : - Data Definition: Allows creation and modification of database schemas. - Data Manipulation : Supports querying, updating, and deleting data. - Data Security: Manages user access and data integrity.  3. Table (Relation) Definition: A table, also known as a relation, is a collection of rows and columns used to store data in a relational database. C...