You are on page 1of 2

PROGRAM:

n=int(input("Enter the number of quadarples:"))

b=[list(map(str,input().split())) for i in range(n)]

ind=[]

a=[]

for i in range(n):

opr=b[i][0]

op1=b[i][1]

op2=b[i][2]

res=b[i][3]

if(opr=='+' and (op1=='0' or op2=='0') and (res==op1 or res==op2)):

ind.append(i)

elif(opr=='-' and op2=='0' and res==op1):

ind.append(i)

elif(opr=='*' and (op1=='1' or op2=='1') and (res==op1 or res==op2)):

ind.append(i)

elif(opr=='/' and op2=='1' and res==op1):

ind.append(i)

for i in range(n):

if(i not in ind):

Page No.:
a.append(b[i])

print("after algebraic simplification:")

for i in a:

for j in i:

print(j,end=' ')

print('',sep='\n')

OUTPUT:

RESULT:

Page No.:

You might also like