0% found this document useful (0 votes)
6 views2 pages

PR 13

The document contains Python programs demonstrating matrix operations using NumPy, including addition, subtraction, multiplication, and division. It also includes a program to concatenate two strings and generate six random integers between 10 and 30. Each program is accompanied by its output results.

Uploaded by

Prasad Pangarkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

PR 13

The document contains Python programs demonstrating matrix operations using NumPy, including addition, subtraction, multiplication, and division. It also includes a program to concatenate two strings and generate six random integers between 10 and 30. Each program is accompanied by its output results.

Uploaded by

Prasad Pangarkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Write a Python program to create two Matrix and perform

addition,substraction ,multiplication and division on matrix

import numpy as np

a = np.array([1,2,3,4])

b = np.array([4,3,2,1])

print("Addition=",a+b)

print("mult=",a*b)

print("div=",a/b)

print("subtraction=",a-b)

output - =

C:/Users/Administrator/AppData/Local/Programs/Python/Python313/pr12.py

Addition= [5 5 5 5]

mult= [4 6 6 4]

div= [0.25 0.66666667 1.5 4. ]

subtraction= [-3 -1 1 3]

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------

2) Write a program to concatenate two string

import numpy as n

str1="ADESH"

str2="DOIPHODE"

print("String Concatenate",n.char.add(str1,str2))

output –

RESTART:C:/Users/Administrator/AppData/Local/Programs/Python/Python313/12.2.py

String Concatenate ADESHDOIPHODE

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
3) Write a Numpy program to generate six random number integers between 10 and 30.

import numpy as np

a = np.random.randint(10,30,6)

print("random six in 10 to 30 :",a)

output-

RESTART: C:/Users/Administrator/AppData/Local/Programs/Python/Python313/12.1.py

random six in 10 to 30 : [16 13 25 15 11 28]

You might also like