0% found this document useful (0 votes)
3 views10 pages

Sep Project

The document presents a software experimentation project focused on displaying two matrices using the NumPy library in Python. It provides an overview of Python and NumPy, detailing their functionalities and advantages, particularly in data science. The document includes a program that prompts users to input matrix dimensions and elements, explaining the code structure and logic behind it.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views10 pages

Sep Project

The document presents a software experimentation project focused on displaying two matrices using the NumPy library in Python. It provides an overview of Python and NumPy, detailing their functionalities and advantages, particularly in data science. The document includes a program that prompts users to input matrix dimensions and elements, explaining the code structure and logic behind it.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Software Experimentation Project

Display 2 Matrices in NumPy

Presented by :-
Mentored by:-
A58 – Raulji Jaydeep Singh
Prof. Ruchika Rami
A37 – Palasara Salman
A56 - Rana Amaan
WHAT IS PYTHON ?
• Python is a general purpose
interpreted interactive object
oriented and high level
programming language.
• It was first introduced in 1991by
Guido van Rossum , a Dutch
computer programmer.
• The language place strong
emphasis on code reliability and
simplicity so that the
programmers can develop
application rapidly
WHAT IS NUMPY ?
▪ INTRODUCTION
• NumPy is a Python library used for working with arrays.
• It also has functions for working in domain of linear algebra,
fourier transform, and matrices.
• NumPy was created in 2005 by Travis Oliphant. It is an open
source project and you can use it freely.

• NumPy stands for Numerical Python .


▪ USES
• In Python we have lists that serve the purpose of arrays, but they
are slow to process.
• NumPy aims to provide an array object that is up to 50x faster
than traditional Python lists.
• Arrays are very frequently used in data science, where speed
and resources are very important.
Program
Display 2 Matrices in NumPy
row=int(input("Enter a number of rows"))
column=int(input("Enter a number of column"))
First Matrix
matrix = []
for i in range(row):
c=[]
for j in range(column):
j = int(input("enter a number in array
element "+str(i)+" "+str(j)+" "))
c.append(j)
print()
matrix.append(c)
for i in range(row):
for j in range(column):
print(matrix[i][j],end=" ")
print()
Second Matrix
row=int(input("Enter a number of rows"))
column=int(input("Enter a number of column"))

matrix = []

for i in range(row):
c=[]
for j in range(column):
j = int(input("enter a number in second array
element"+str(i)+" "+str(j)+" "))
c.append(j)
print()
matrix.append(c)

for i in range(row):
for j in range(column):
print(matrix[i][j],end=" ")
print()
Program Explanation
• The User Enter the Number of Rows for the Matrix and assign the entered value to the row
variable after converting it to an integer.
• The User Enter the Number of Columns for the Matrix and assign the entered value to the
column variable after converting it to an integer.
• Matrix[] – initialize an Empty array.
• for i in range(row): Start a loop that iterates over the range of values from 0 to row-
1.it is used for iterating through each row of the matrix.
• c=[] :-initialize an empty array.
• for j in range(column): Start a nested loop that iterates over the range of values
from 0 to column-1.it is used for iterating through each column of the current row.
• j = int(input("enter a number in second array element"+str(i)+"
"+str(j)+" ")) :- The user to Enter a Number for the current matrix
element and assign the entered value to the variable ‘j’. After
converting it an integer. The use of str(i) and str(j) is for
displaying the current position in the matrix while taking input.
• c.append(j):- Adds the entered value(‘j’) to the array ‘c’,
representing the current row.
• Print() :- Prints a newline to separate rows in the output.
• matrix.append(c) :- Appends the array of ‘c’ to the main matrix
array.
• for i in range(row): - Initiates another loop to iterate over the
rows of the matrix for printing.
• for j in range(column): - Initiates a nested loop to iterate over
the columns of the matrix for printing.
• print(matrix[i][j],end=" ") :- Prints each element of the matrix
at position ‘[i][j]’ followed by a space.
• Print() :- Prints a newline after each row to format the matrix in
a readable way.

• This code takes a user input to create a matrix, stores it in a


list, and then prints the matrix.
Thank you

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy