Support our Blind Hand Charity by donating at 9818291723. Your contribution has the potential to bring about significant positive change for humanity.

Search This Blog

Sunday, August 13, 2023

SUM OF EACH ROW AND COLUMN OF A MATRIX

r=int(input("Enter number of rows = "))
c=int(input("Enter number of columns = "))
l=[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]
t=[]
m=[]
k=[]
for i in range(0,c):
    for j in range(0,r):
        x=int(input("Enter the element = "))
        l[i][j]=x
        
for i in range(0,c):
    s=0
    m=0
    for j in range(0,r):
        s+=l[i][j]
        m+=l[j][i]
    k.append(s)
    t.append(m)

for i in range(0,r):
    for j in range(0,c):
        print(l[i][j],end=',')
        if j==c-1:
            print('--->',end='')
    if j==c-1:
        print(k[i])

for i in range(-r,r):
    if i>=0:
        print(t[i],end='')
    else:
        print('| '*3)

OUTPUT



SEARCH WORD IN A PARAGRAPH

t=0
while t!=3:
    print("""Choose the operation:
1.Search and Show
2.Change String
3.Exit""")
    t=int(input("Enter the operation number = "))
    if t==3:
        break
    elif t==1:
        k=0
        s=input("Enter characters to search = ")
        for i in n.split():
            str(i)
            if s==i[0:len(s)]:
                print(i)
                k=1
        if k==0:
            print("NO WORD FOUND")
    elif t==2:
        n=input("Enter a string = ")
    print()

OUTPUT





Saturday, August 5, 2023

DETERMINANTS

r1=int(input("Enter row of first matrix less than 6 = "))

c1=int(input("Enter column of first matrix less than 6 = "))


if r1==c1:

    l=[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]

    p=[]

    y=0

    x=0

    

    for i in range(0,3):

        for j in range(0,3):

            x=int(input("Enter a number ="))

            l[i][j]=x

            

    for i in range(0,r1):

        for j in range(0,r1):

            print(l[i][j],end=' ')

        print()

    for i in range(0,r1):

        for j in range(0,r1):

            if j!=i and i!=2:

                x=l[1][j]*l[2][j+i+1]

                y=l[1][j+1+i]*l[2][j]

                if i%2==0:

                    p.append(l[0][i]*(x-y))

                else:

                    p.append(l[0][i]*(y-x))

            if j!=i and i==2 and j!=1:

                x=l[1][j]*l[2][j+i-1]

                y=l[1][j-1+i]*l[2][j]

                p.append(l[0][i]*(x-y))

        print()

    c=0

    for i in range(0,len(p)):

        c+=p[i]

    print("Determinants =",c)

OUTPUT

CIRCLE PLOTTER

import matplotlib.pyplot as mp
import numpy as np
r=int(input("Enter the radius of circle = "))
mp.grid()
a=np.linspace(0,360,10000000)
x=r*np.cos(a)
y=r*np.sin(a)
mp.plot(x,y)
mp.show()

OUTPUT