Software Experimentation Project-1
Software Experimentation Project-1
Course: - SY iMCA
Div :- A
What is NumPy?
➢ NumPy stands for numeric python which is a python package for the
computation and processing of the multidimensional and single
dimensional array elements.
➢ 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 is the fundamental package for scientific computing in
Python. It is a Python library that provides a multidimensional
array object, various derived objects (such as masked arrays
and matrices), and an assortment of routines for fast
operations on arrays, including mathematical, logical, shape
manipulation, sorting, selecting, I/O, discrete Fourier
transforms, basic linear algebra, basic statistical operations,
random simulation and much more.
Uses of NumPy.
➢ Arithmetic Operation.
➢ Statistical Operation.
➢ Bitwise Operations.
➢ Copying and Viewing arrays.
➢ Stacking.
➢ Linear Algebra.
➢ Broadcasting.
➢ Mathematical Operations.
➢ Searching, sorting and counting.
Features of NumPy.
➢ Efficient Array Operation.
➢ Slicing Array.
➢ Random Number Generation.
➢ Numerical Computing Tools.
➢ Universal function.
Download Procedural.
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 Matrices Program.
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 array, and
then prints the matrix.