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

MY PROGRAMMES

Sunday, April 30, 2023

MATHEMATICAL SERIES AND THER SUM

PATTERN-1

n=int(input("Enter the range of the pattern = "))
s=0
x=1
for i in range(1,n+1):
    if i==n:
        print(i,"!",end="",sep="")
    elif i!=0:
        print(i,"!",end="+",sep="")
    for j in range (1,i+1):
        x=x*j
    s=s+x
    x=1
print("\n","The sum of factorials =",s)

OUTPUT

Enter the range of the pattern = 5
1!+2!+3!+4!+5!
 The sum of factorials = 153

PATTERN-2

n=int(input("Enter the range of the pattern = "))
s=0
x=1
for i in range(1,n+1):
    if i==n:
        print(i,"/",(i+1),end="",sep="")
    elif i!=0:
        print(i,"/",(i+1),end=" + ",sep="")
    for j in range (1,i+1):
        x=i/(j+1)
    s=s+x
print("\n","The sum of the pattern =",s)

OUTPUT

Enter the range of the pattern = 5
1/2 + 2/3 + 3/4 + 4/5 + 5/6
 The sum of the pattern = 3.5500000000000003

PATTERN-3

x=int(input("Enter the base of the pattern = "))
n=int(input("Enter the range of the pattern = "))
t=x
s=0
for i in range(1,n+1):
    if i==n:
        print(x,"^",i,end="",sep="")
    else:
        print(x,"^",i,end="+ ",sep="")
    x=x**i
    s+=x
    x=t
print("\n","The sum of the number =",s)

OUTPUT

Enter the base of the pattern = 5
Enter the range of the pattern = 3
5^1+ 5^2+ 5^3
 The sum of the number = 155

PATTERN-4

x=int(input("Enter the base of the pattern = "))
n=int(input("Enter the range of the pattern = "))
t=1
s=0
for i in range(1,n+1):
    if i==n:
        print(x,"^",i,"/",i,"!",sep="",end="")
    else:
        print(x,"^",i,"/",i,"!",sep="",end=" + ")
    for j in range(1,i+1):
        t=t*j
    s+=(x**i)/t
    t=1
print("\n","The sum of the numebers =",s)

OUTPUT

Enter the base of the pattern = 5
Enter the range of the pattern = 3
5^1/1! + 5^2/2! + 5^3/3!
The sum of the numbers = 38.33333333333333

PATTERN-5

n=int(input("Enter the range of the pattern = "))
x=0
s=0
print("1+(1+2)+(1+2+3)+(!+2+3+4)+.....(1+2+3+4+....+n)")
for i in range(1,n+1):
    for j in range(1,i+1):
        x=x+1
    s+=x
print("\n","The sum of numbers =",s)

OUTPUT

Enter the range of the pattern = 3
1+(1+2)+(1+2+3)+(!+2+3+4)+.....(1+2+3+4+....+n)

The sum of numbers = 10

PATTERN-6

n=int(input("Enter the range of the pattern = "))
x=0
s=0
for i in range(0,n):
    if i==n-1:
        print(i+1,"^3",end="",sep="")
    else:
        print(i+1,"^3",end=" + ",sep="")
    x=(i+1)**3
    s+=x
    x=0
print("\n","The sum of numbers =",s)

OUTPUT

Enter the range of the pattern = 5
1^3 + 2^3 + 3^3 + 4^3 + 5^3
 The sum of numbers = 225

Saturday, April 29, 2023

GEOMETRICAL PATTERNS

PATTERN-1

n=int(input("Enter the number of rows of the pattern = "))
for i in range(1,n+1):
    for j in range(1,i+1):print("*",end="")
    print(" ")

OUTPUT





PATTERN-2

n=int(input("Enter the number of rows of the pattern = "))
for i in range(n,0,-1):
    for j in range(i,0,-1):
        print("*",end="")
    print(" ")

OUTPUT





PATTERN-3

n=int(input("Enter the number of rows in the pattern = "))
for i in range(1,n+1):
    for j in range(1,n+1):print("*",end="")
    print(" ")

OUTPUT


 



PATTERN-4

n=int(input("Enter the number of rows in the pattern = "))
for i in range(1,n+1):
    for j in range(1,n+1):
        if (i==1 or j==1 or j==n or i==n):print("*",end="")
        else: print(end=" ")
    print(" ")

OUTPUT





PATTERN-5

n=int(input("Enter the number of rows in the pattern = "))
for i in range(0,n+1):
    for k in range(n+1,i+1,-1):
        print(" ",end="")
    for j in range(0,i+1):
        print("* ",end="")
    print(" ")

OUTPUT






PATTERN-6

n=int(input("Enter the number of rows in the pattern = "))
for i in range(0,n+1):
    for k in range(n,i,-1):
        print(" ",end="")
    for j in range(0,n+1):
        print("*",end="")
    print(" ")

OUTPUT






PATTERN-7

n=int(input("Enter the number of rows in the pattern = "))
for i in range(0,n+1):
    for k in range(n+1,i,-1):
        print(" ",end="")
    for j in range(0,i+1):
        if i==n or j==i or j==0:
            print("* ",end="")
        else:
            print("  ",end="")
    print(" ")

OUTPUT






PATTERN-8

n=int(input("Enter the number of rows of the pattern = "))
for i in range(n,0,-1):
    for k in range(n+1,i,-1):
        print("   ",end="")
    for j in range(1,i+1):
        if i==n or j==i or j==n or j==1:
            print("* ",end="")
        else:
            print("  ",end="")
    print(" ")

OUTPUT






PATTERN-9

n=int(input("Enter the number of rows of the pattern = "))
for i in range(n,0,-1):
    for k in range(n,i+1,-1):
        print(" ",end="")
    for j in range(0,i+1):
        if i==n or j==i or j==1 or j==n:
            print("* ",end="")
        else:
            print("  ",end="")
    print(" ")

OUTPUT







PATTERN-10

n=int(input("Enter the number = "))
s=0
p=0
while n!=0: 
    d=n%10
    p=p*10+d
    n=n//10
    s+=1
for i in range(0,s):
    for k in range(s,i,-1):
        print(" ",end="")
    for j in range(0,i+1):
        x=p%10
        if i==s or j==i or j==0 or (i+1)==s:
            print(x,"",end="")
        else:
            print("  ",end="")
    p=p//10
    print(" ")

OUTPUT






PATTERN-11

n=int(input("Enter the number = "))
s=0
p=0
while n!=0:
    d=n%10
    p=p*10+d
    n=n//10
    s+=1
for i in range(0,s):
    for j in range(0,i+1):
        t=p%10
        if j==i or i==s or j==0 or (i+1)==s:
            print(t,"",end="")
        else:
            print("  ",end="")
    p=p//10
    print(" ")

OUTPUT





PATTERN-12

n=int(input("Enter the number of rows in the pattern = "))
if n%2!=0:
    for i in range(1,n+1):
        for j in range(1,n+1):
            if i==(n+1)/2and j==(n+1)/2:
                print("  ",end="")
            else:
                print("# ",end="")
        print(" ")
elif n%2==0:
    for i in range(1,1+n):
        for j in range(1,n+1):
            if (i==n//2 and j==n//2):
                print("  ",end="")
            elif (i==(n//2)+1 and j==(n//2)+1):
                print("  ",end="")
            elif (i==(n//2) and j==(n//2)+1):
                print("  ",end="")
            elif (i==(n//2)+1 and j==(n//2)):
                print("  ",end="")
            else:
                print("# ",end="")
        print(" ")

OUTPUT(FOR ODD LENGTH)






OUTPUT(FOR EVEN LENGTH)






PATTERN-13

n=int(input("Enter the side of square in the pattern = "))
for i in range(1,n+1):
    for j in range(1,n+1):
        if j==1 or i==1 or j==n or i==n or i==2 or i==(n-1) or j==2 or j==(n-1):
            print("* ",end="")
        else:
            print("  ",end="")
    print()

OUTPUT






PATTERN-14

l=int(input("Enter the length of the pattern = "))
b=int(input("Enter the breadth of the pattern = "))
for i in range(1,l+1):
    for j in range(1,b+1):
        if j==1 or i==1 or i==l or j==b or i==(l-1) or j==(b-1) or j==2 or i==2:
            print("* ",end="")
        else:
            print("  ",end="")
    print()

OUTPUT







PATTERN-15

n=int(input("Enter the number = "))
p=0
s=0
b=n
while n!=0:
    d=n%10
    p=p*10+d
    s+=1
    n=n//10
for i in range(1,s+1):
    e=p%10
    for j in range(0,i):
        print(e,end="")
    p=p//10
    print()

OUTPUT

Saturday, April 22, 2023

NUMBER REVERSE

n=int(input("Enter a number = "))
x=0
while n!=0:
    q=n%10
    x=x*10+q
    n=n//10
print("The reversed number =",x)

OUTPUT



MARKS PERCENTAGE WITH GRADE

 m=input("Enter the name of child  = ")
x=0
for i in range (1,6):
    x+=int(input("Enter the marks of subject = "))
n=x/5
if (n>0 and n<=30):print("Your Name =",m,"\n","Your percentage =",n,"\n","Your grade = D")
elif (n>=31 and n<=60):print("Your Name =",m,"\n","Your percentage =",n,"\n","Your grade = C")
elif (n>=61 and n<=80):print("Your Name =",m,"\n","Your percentage =",n,"\n","Your grade = B")
elif (n>=81 and n<=90):print("Your Name =",m,"\n","Your percentage =",n,"\n","Your grade = A2")
elif (n>=91 and n<=100):print("Your Name =",m,"\n","Your percentage =",n,"\n","Your grade = A1")
else: print(end="")

TEXT TO MORSE CODE(USING HYPHEN AND DOT)

m=input("Enter the text = ")
for x in m:
    if x=='A' or x=='a':print(".- ",end="")
    elif x=='B' or x=='b':print("-... ",end="")
    elif x=='C' or x=='c':print("-.-. ",end="")
    elif x=='D' or x=='d':print("-.. ",end="")
    elif x=='E' or x=='e':print(". ",end="")
    elif x=='F' or x=='f':print("..-. ",end="")
    elif x=='G' or x=='g':print("--. ",end="")
    elif x=='H' or x=='h':print(".... ",end="")
    elif x=='I' or x=='i':print(".. ",end="")
    elif x=='J' or x=='j':print(".--- ",end="")
    elif x=='K' or x=='k':print("-.- ",end="")
    elif x=='L' or x=='l':print(".-.. ",end="")
    elif x=='M' or x=='m':print("-- ",end="")
    elif x=='N' or x=='n':print("-. ",end="")
    elif x=='O' or x=='o':print("--- ",end="")
    elif x=='P' or x=='p':print(".--. ",end="")
    elif x=='Q' or x=='q':print("--.- ",end="")
    elif x=='R' or x=='r':print(".-. ",end="")
    elif x=='S' or x=='s':print("... ",end="")
    elif x=='T' or x=='t':print("- ",end="")
    elif x=='U' or x=='u':print("..- ",end="")
    elif x=='V' or x=='v':print("...- ",end="")
    elif x=='W' or x=='w':print(".-- ",end="")
    elif x=='X' or x=='x':print("-..- ",end="")
    elif x=='Y' or x=='y':print("-.-- ",end="")
    elif x=='Z' or x=='z':print("--.. ",end="")
    elif x==' ':print("/",end="")
    elif x=='.':print(".-.-.- ",end="")
    elif x=='?':print("..--.. ",end="")
    elif x=='!':print("-.-.-- ",end="")
    elif x==';':print("-.-.-. ",end="")
    elif x==',':print("--..-- ",end="")
    elif x==':':print("---... ",end="")
    elif x=='+':print(".-.-. ",end="")
    elif x=='-':print("-....- ",end="")
    elif x=='/':print("-..-. ",end="")
    elif x=='=':print("-...- ",end="")
    elif x=='1':print(".---- ",end="")
    elif x=='2':print("..--- ",end="")
    elif x=='3':print("...-- ",end="")
    elif x=='4':print("....- ",end="")
    elif x=='5':print("..... ",end="")
    elif x=='6':print("-.... ",end="")
    elif x=='7':print("--... ",end="")
    elif x=='8':print("---.. ",end="")
    elif x=='9':print("----. ",end="")
    elif x=='0':print("----- ",end="")
    elif x=='(':print("-.--. ",end="")
    elif x==')':print("-.--.- ",end="")
    elif x=='&':print(".-... ",end="")
    elif x=='"':print(".-..-. ",end="")
    elif x=='$':print("...-..- ",end="")
    elif x=='@':print(".--.-. ",end="")
    elif x=='_':print("..--.- ",end="")

TEXT TO MORSE CODE(USING UNDERSCORE AND DOT)

m=input("Enter the text = ")
for x in m:
    if x=='A' or x=='a':print("._ ",end="")
    elif x=='B' or x=='b':print("_... ",end="")
    elif x=='C' or x=='c':print("_._. ",end="")
    elif x=='D' or x=='d':print("_.. ",end="")
    elif x=='E' or x=='e':print(". ",end="")
    elif x=='F' or x=='f':print(".._. ",end="")
    elif x=='G' or x=='g':print("__. ",end="")
    elif x=='H' or x=='h':print(".... ",end="")
    elif x=='I' or x=='i':print(".. ",end="")
    elif x=='J' or x=='j':print(".___ ",end="")
    elif x=='K' or x=='k':print("_._ ",end="")
    elif x=='L' or x=='l':print("._.. ",end="")
    elif x=='M' or x=='m':print("__ ",end="")
    elif x=='N' or x=='n':print("_. ",end="")
    elif x=='O' or x=='o':print("___ ",end="")
    elif x=='P' or x=='p':print(".__. ",end="")
    elif x=='Q' or x=='q':print("__._ ",end="")
    elif x=='R' or x=='r':print("._. ",end="")
    elif x=='S' or x=='s':print("... ",end="")
    elif x=='T' or x=='t':print("_ ",end="")
    elif x=='U' or x=='u':print(".._ ",end="")
    elif x=='V' or x=='v':print("..._ ",end="")
    elif x=='W' or x=='w':print(".__ ",end="")
    elif x=='X' or x=='x':print("_.._ ",end="")
    elif x=='Y' or x=='y':print("_.__ ",end="")
    elif x=='Z' or x=='z':print("__.. ",end="")
    elif x==' ':print("/",end="")
    elif x=='.':print("._._._ ",end="")
    elif x=='?':print("..__.. ",end="")
    elif x=='!':print("_._.__ ",end="")
    elif x==';':print("_._._. ",end="")
    elif x==',':print("__..__ ",end="")
    elif x==':':print("___... ",end="")
    elif x=='+':print("._._. ",end="")
    elif x=='-':print("_...._ ",end="")
    elif x=='/':print("_.._. ",end="")
    elif x=='=':print("_..._ ",end="")
    elif x=='1':print(".____ ",end="")
    elif x=='2':print("..___ ",end="")
    elif x=='3':print("...__ ",end="")
    elif x=='4':print("...._ ",end="")
    elif x=='5':print("..... ",end="")
    elif x=='6':print("_.... ",end="")
    elif x=='7':print("__... ",end="")
    elif x=='8':print("___.. ",end="")
    elif x=='9':print("____. ",end="")
    elif x=='0':print("_____ ",end="")
    elif x=='(':print("_.__. ",end="")
    elif x==')':print("_.__._ ",end="")
    elif x=='&':print("._... ",end="")
    elif x=='"':print("._.._. ",end="")
    elif x=='$':print("..._.._ ",end="")
    elif x=='@':print(".__._. ",end="")
    elif x=='_':print("..__._ ",end="")

Tuesday, April 18, 2023

DAY CALCULATOR

print("""
MONDAY = 1
TUESDAY = 2
WEDNESDAY = 3
THURSDAY = 4
FRIDAY = 5
SATURDAY = 6
SUNDAY = 7
""")
n=int(input("Enter the number = "))
d=int(input("Enter the number of days = "))
f=d%7
x=f+n
if n==1:
    if x==1:print("The day is Monday")
    elif x==2:print("The day is Tuesday")
    elif x==3:print("The day is Wednesday")
    elif x==4:print("The day is Thursday")
    elif x==5:print("The day is Friday")
    elif x==6:print("The day is Saturday")
    elif x==7:print("The day is Sunday")
    else: print(end="")
elif n==2:
    if x==2:print("The day is Monday")
    elif x==3:print("The day is Tuesday")
    elif x==4:print("The day is Wednesday")
    elif x==5:print("The day is Thursday")
    elif x==6:print("The day is Friday")
    elif x==7:print("The day is Saturday")
    elif x==8:print("The day is Sunday")
    else: print(end="")
elif n==3:
    if x==3:print("The day is Monday")
    elif x==4:print("The day is Tuesday")
    elif x==5:print("The day is Wednesday")
    elif x==6:print("The day is Thursday")
    elif x==7:print("The day is Friday")
    elif x==8:print("The day is Saturday")
    elif x==9:print("The day is Sunday")
    else: print(end="")
elif n==4:
    if x==4:print("The day is Monday")
    elif x==5:print("The day is Tuesday")
    elif x==6:print("The day is Wednesday")
    elif x==7:print("The day is Thursday")
    elif x==8:print("The day is Friday")
    elif x==9:print("The day is Saturday")
    elif x==10:print("The day is Sunday")
    else: print(end="")
elif n==5:
    if x==5:print("The day is Monday")
    elif x==6:print("The day is Tuesday")
    elif x==7:print("The day is Wednesday")
    elif x==8:print("The day is Thursday")
    elif x==9:print("The day is Friday")
    elif x==10:print("The day is Saturday")
    elif x==11:print("The day is Sunday")
    else: print(end="")
elif n==6:
    if x==6:print("The day is Monday")
    elif x==7:print("The day is Tuesday")
    elif x==8:print("The day is Wednesday")
    elif x==9:print("The day is Thursday")
    elif x==10:print("The day is Friday")
    elif x==11:print("The day is Saturday")
    elif x==12:print("The day is Sunday")
    else: print(end="")
elif n==7:
    if x==7:print("The day is Monday")
    elif x==8:print("The day is Tuesday")
    elif x==9:print("The day is Wednesday")
    elif x==10:print("The day is Thursday")
    elif x==11:print("The day is Friday")
    elif x==12:print("The day is Saturday")
    elif x==13:print("The day is Sunday")
    else: print(end="")
else: print(end="The number entrered is incorrect")

DATE INTERVAL CALCULATOR

print("Write date in dd/mm/yyyy format")
print("Enter the values of first date")
d1=int(input("Enter the dd = "))
print("If month from 1 to 9 write without zero else write normally")
m1=int(input("Enter the mm = "))
y1=int(input("Enter the yyyy = "))
print("Enter the values of second date")
d2=int(input("Enter the dd = "))
print("If month from 1 to 9 write without zero else write normally")
m2=int(input("Enter the mm = "))
y2=int(input("Enter the yyyy = "))
print("""
YES = 1
N0 = 0""")
l=int(input("Include the end date or not = ")) 
print("The first date entered =",d1,"/",m1,"/",y1)
print("The second date entered =",d2,"/",m2,"/",y2)
if (y1)%4==0:
    if m1==2:
        if (d1>0 and d1<=29): print(end="")
        else: print("The first date is invalid")
    if (m1==1 or m1==3 or m1==5 or m1==7 or m1==9 or m1==11):
        if(d1>0 and d1<=30): print("")
        else: print("The first date is invalid")
    elif (m1==4 or m1==6 or m1==8 or m1==10 or m1==12):
        if(d1>0 and d1<=31):print("")
        else: print("The first date is invalid")
    else:print("The first date is invalid")
else:
    if m1==(2):
        if (d1>0 and d1<=28): print(end="")
        else: print("The date is invalid")
    if (m1==1 or m1==3 or m1==5 or m1==7 or m1==9 or m1==11):
        if(d1>0 and d1<=30): print("")
        else: print("The date is invalid")
    elif (m1==4 or m1==6 or m1==8 or m1==10 or m1==12):
        if(d1>0 and d1<=31):print(end="")
        else: print("The date is invalid")
    else:print("The date is invalid")
if (y2)%4==0:
    if m2==2:
        if (d2>0 and d2<=29): print(end="")
        else: print("The second date is invalid")
    if (m2==1 or m2==3 or m2==5 or m2==7 or m2==9 or m2==11):
        if(d2>0 and d2<=30): print("")
        else: print("The second date is invalid")
    elif (m2==4 or m2==6 or m2==8 or m2==10 or m2==12):
        if(d2>0 and d2<=31):print("")
        else: print("The second date is invalid")
    else:print("The second date is invalid")
else:
    if m1==(2):
        if (d2>0 and d2<=28): print(end="")
        else: print("The second date is invalid")
    if (m2==1 or m2==3 or m2==5 or m2==7 or m2==9 or m2==11):
        if(d2>0 and d2<=30): print("")
        else: print("The second date is invalid")
    elif (m2==4 or m2==6 or m2==8 or m2==10 or m2==12):
        if(d2>0 and d2<=31):print(end="")
        else: print("The second date is invalid")
    else:print("The second date is invalid")
if (d1>0 and d1<=31 and d2>0 and d2<=31):
    x=abs(d2-d1)
    y=abs(m2-m1)
    z=abs(y2-y1)
    if l==0:print("The interval between the entered dates =",x,"days",y,"months",z,"years")
    elif l==1:print("The interval between the entered dates =",x+1,"days",y,"months",z,"years")
    else:print(end="")
else:print(end="")

Sunday, April 16, 2023

CHECK FOR VALIDITY OF A DATE

print("Write date in dd/mm/yyyy format")
d=int(input("Enter the date = "))
print("If month from 1 to 9 write without zero else write normally")
m=int(input("Enter the month = "))
y=int(input("Enter the year = "))
print("The date entered =",d,"/",m,"/",y)
if y%4==0:
    if m==2:
        if (d>0 and d<=29): print(end="")
        else: print("The date is invalid")
    if (m==1 or m==3 or m==5 or m==7 or m==9 or m==11):
        if(d>0 or d<=30): print("The date is valid")
        else: print("The date is invalid")
    elif (m==4 or m==6 or m==8 or m==10 or m==12):
        if(d>0 or d<=31):print("The date is valid")
        else: print("The date is invalid")
    else:print("The date is invalid")
else:
    if m==(2):
        if (d>0 and d<=28): print(end="The date is valid")
        else: print("The date is invalid")
    if (m==1 or m==3 or m==5 or m==7 or m==9 or m==11):
        if(d>0 or d<=30): print("The date is valid")
        else: print("The date is invalid")
    elif (m==4 or m==6 or m==8 or m==10 or m==12):
        if(d>0 or d<=31):print(end="The date is valid")
        else: print("The date is invalid")
    else:print("The date is invalid")

RESULT GRADING THROUGH PERCENTAGE

n=input("Enter your name = ")
a1=input("Enter the name of the first subject = ")
a2=float(input("Enter the marks of first subject = "))
b1=input("Enter the name of the second subject = ")
b2=float(input("Enter the marks of second subject = "))
c1=input("Enter the name of the third subject = ")
c2=float(input("Enter the marks of third subject = "))
d1=input("Enter the name of the fourth subject = ")
d2=float(input("Enter the marks of fourth subject = "))
e1=input("Enter the name of the fifth subject = ")
e2=float(input("Enter the marks of fifth subject = "))
p=(a2+b2+c2+d2+e2)/5
if (p<30 and p>0):
    print("Percentage =",p,"%"."\n""Grade D")
elif (p<60 and p>31):
    print("Percentage =",p,"%"."\n""Grade C")
elif (p<80 and p>61):
    print("Percentage =",p,"%"."\n""Grade B")
elif (p<90 and p>81):
    print("Percentage =",p,"%"."\n""Grade A2")
elif (p<=100 and p>91):
    print("Percentage =",p,"%"."\n""Grade A1")
else:
    print(end="")

DIGIT TO WORD CONVERSION

f=int(input("Enter the number of digits in the number = "))
n=int(input("Enter the number = "))
if f==3:
    q3=n%10
    n=n//10
    q2=n%10
    n=n//10
    q1=n%10
    n=n//10
    if q1==1: print("One")
    elif q1==2: print("Two")
    elif q1==3: print("Three")
    elif q1==4: print("Four")
    elif q1==5: print("Five")
    elif q1==6: print("Six")
    elif q1==7: print("Seven")
    elif q1==8: print("Eight")
    elif q1==9: print("Nine")
    elif q1==0: print("Zero")
    else: print("It is a wrong number")
    if q2==1: print("One")
    elif q2==2: print("Two")
    elif q2==3: print("Three")
    elif q2==4: print("Four")
    elif q2==5: print("Five")
    elif q2==6: print("Six")
    elif q2==7: print("Seven")
    elif q2==8: print("Eight")
    elif q2==9: print("Nine")
    elif q2==0: print("Zero")
    else: print("It is a wrong number")
    if q3==1: print("One")
    elif q3==2: print("Two")
    elif q3==3: print("Three")
    elif q3==4: print("Four")
    elif q3==5: print("Five")
    elif q3==6: print("Six")
    elif q3==7: print("Seven")
    elif q3==8: print("Eight")
    elif q3==9: print("Nine")
    elif q3==0: print("Zero")
    else: print("It is a wrong number")
elif f==4:
    q4=n%10
    n=n//10
    q3=n%10
    n=n//10
    q2=n%10
    n=n//10
    q1=n%10
    n=n//10
    if q1==1: print("One")
    elif q1==2: print("Two")
    elif q1==3: print("Three")
    elif q1==4: print("Four")
    elif q1==5: print("Five")
    elif q1==6: print("Six")
    elif q1==7: print("Seven")
    elif q1==8: print("Eight")
    elif q1==9: print("Nine")
    elif q1==0: print("Zero")
    else: print("It is a wrong number")
    if q2==1: print("One")
    elif q2==2: print("Two")
    elif q2==3: print("Three")
    elif q2==4: print("Four")
    elif q2==5: print("Five")
    elif q2==6: print("Six")
    elif q2==7: print("Seven")
    elif q2==8: print("Eight")
    elif q2==9: print("Nine")
    elif q2==0: print("Zero")
    else: print("It is a wrong number")
    if q3==1: print("One")
    elif q3==2: print("Two")
    elif q3==3: print("Three")
    elif q3==4: print("Four")
    elif q3==5: print("Five")
    elif q3==6: print("Six")
    elif q3==7: print("Seven")
    elif q3==8: print("Eight")
    elif q3==9: print("Nine")
    elif q3==0: print("Zero")
    else: print("It is a wrong number")
    if q4==1: print("One")
    elif q4==2: print("Two")
    elif q4==3: print("Three")
    elif q4==4: print("Four")
    elif q4==5: print("Five")
    elif q4==6: print("Six")
    elif q4==7: print("Seven")
    elif q4==8: print("Eight")
    elif q4==9: print("Nine")
    elif q4==0: print("Zero")
    else: print("It is a wrong number")
else:("It is a wrong number")

CHECK FOR PALINDROME

f=int(input("Enter the number of digits in your number = "))
n=int(input("Enter a number = "))
if f==4:
    q1=n%10
    n=n//10
    q2=n%10
    n=n//10
    q3=n%10
    n=n//10
    q4=n%10
    n=n//10
    if q1==q4:
        if q2==q3:
            print("The number is a palindrome")
        else: print("The number is not a palindrome")
    else: print("The number is not a palindrome")
elif f==3:
    q1=n%10
    n=n//10
    q2=n%10
    n=n//10
    q3=n%10
    n=n//10
    if q1==q3:
        print("The number is a palindrome")
    else: print("The number is not a palindrome")
else:
    print(end="")

Saturday, April 15, 2023

INCOME TAX THROUGH SLAB SYSTEM

y=float(input("Enter your yearly salary = "))
n=float(input("Enter the rent recieving = "))
q=float(input("Enter the yearly expense on consumer goods= "))
s=float(input("Enter the bills paid in one financial year ="))
z=float(input("Enter the amount paid on education = "))
d=float(input("Enter the amount paid on insurance of all the vehicles annually = "))
p=float(input("Enter the rent paid = "))
t=y-(n+p+q+s+z+d)
if (t>=0 and t<=500000):
    t1=0
    print("Due Rs. 0")
elif (t>=500000 and t<=800000):
    t1=0
    t2=(t-500000)*0.1
    print("Your due tax =",t2+t1)
elif (t>=800000 and t<=1100000):
    t1=0
    t2=(500000)*0.1
    t3=(t-1000000)*0.2
    print("Your due tax =",t2+t1+t3)
elif (t>1100000):
    t1=0
    t2=(500000)*0.1
    t3=(500000)*0.2
    t4=(t-1500000)*0.3
    print("Your due tax =",t2+t1+t3+t4)
else:
    a=input("Enter your address = ")
    print("You are a lier. Calling 112")
    print("Calling......")
    print("Calling......")
    print("Calling......")
    print("The cops are reaching at",a,"in 10 minutes")

ELECTRICITY BILL THROUGH SLAB SYSTEM

print("Enter the details of first application")
p1=int(input("Enter the power in Watt = "))
t1=int(input("Enter the number of hours used = "))
n1=int(input("Enter the number of application = "))
print("Enter the details of second application")
p2=int(input("Enter the power in Watt = "))
t2=int(input("Enter the number of hours used = "))
n2=int(input("Enter the number of application = "))
print("Enter the details of third application")
p3=int(input("Enter the power in Watt = "))
t3=int(input("Enter the number of hours used = "))
n3=int(input("Enter the number of application = "))
print("Enter the details of fourth application")
p4=int(input("Enter the power in Watt = "))
t4=int(input("Enter the number of hours used = "))
n4=int(input("Enter the number of application = "))
print("Enter the details of fifth application")
p5=int(input("Enter the power in Watt = "))
t5=int(input("Enter the number of hours used = "))
n5=int(input("Enter the number of application = "))
d=int(input("Enter number of days in the month = "))
e1=(p1*t1*n1)*0.001
e2=(p2*t2*n2)*0.001
e3=(p3*t3*n3)*0.001
e4=(p4*t4*n4)*0.001
e5=(p5*t5*n5)*0.001
e=(e1+e2+e3+e4+e5)*d
if 0<e<=200:
    print("Due Rs =",0)
elif 201<e<=400:
    b1=e-200
    print("The due bill = INR",b1*(3.5))
elif 401<e<=600:
    b1=e-200
    b2=e-400
    print("The due bill = INR",b2*7+b1*3.5)
elif 601<e<=800:
    b1=e-200
    b2=e-400
    b3=e-600
    print("The due bill = INR",b3*7+b2*3.5)
else:
    b1=e-200
    b2=e-400
    b3=e-600
    b4=e-800
    print("The due bill = INR",b4*9+b3*7+b2*3.5)

CHECK FOR ARMSTRONG NUMBER

n=int(input("Enter the number = "))
s=0
d=n
while n!=0:
    q1=n%10
    n=n//10
    s+=(q1**3)
if s==d:
    print("It is an armstrong nummber")
else:
    print("It is not an armstrong number")

COMPLEX ROOTS OF QUADRATIC EQUATION

print("Enter the values in the form of ax^2+bx+c")
a=int(input("Enter the value of a = "))
b=int(input("Enter the value of b = "))
c=int(input("Enter the value of c = "))
d=(b**2)-(4*a*c)
if d<0:
    print("The zero =",(-b)/(2*a),"-i",int((d*-1)**0.5)/(2*a))
    print("The zero =",(-b)/(2*a),"+i",int((-1*d)**0.5)/(2*a))
elif d==0:
    x1=-b/2*a
    x2=-b/2*a
    print("The zeroes are =",x1,x2)
else:
    x1=(-b-(d)**0.5)/2*a
    x2=(-b+(d)**0.5)/2*a
    print("The zeroes are =",x1,x2)

ASCENDING ORDER OF RESULT

a=input("Enter the name of first child = ")
a1=float(input("Enter the marks of English = "))
a2=float(input("Enter the marks of Hindi = "))
a3=float(input("Enter the marks of Mathematics = "))
a4=float(input("Enter the marks of Science = "))
a5=float(input("Enter the marks of Social Science = "))
b=input("Enter the name of second child = ")
b1=float(input("Enter the marks of English = "))
b2=float(input("Enter the marks of Hindi = "))
b3=float(input("Enter the marks of Mathematics = "))
b4=float(input("Enter the marks of Science = "))
b5=float(input("Enter the marks of Social Science = "))
c=input("Enter the name of third child = ")
c1=float(input("Enter the marks of English = "))
c2=float(input("Enter the marks of Hindi = "))
c3=float(input("Enter the marks of Mathematics = "))
c4=float(input("Enter the marks of Science = "))
c5=float(input("Enter the marks of Social Science = "))
am=(a1+a2+a3+a4+a5)/5
bm=(b1+b2+b3+b4+b5)/5
cm=(c1+c2+c3+c4+c5)/5
if am>bm and am>cm:
    if(bm>cm):
        print(a,">",b,">",c)
    else:
        print(a,">",c,">",b)
elif bm>cm and bm>am:
    if(am>cm):
        print(b,">",a,">",c)
    else:
        print(b,">",c,">",a)
if cm>bm and cm>am:
    if(bm>am):
        print(c,">",b,">",a)
    else:
        print(c,">",a,">",b)

COLLINEARTY OR AREA OF TRIANGLE FORMED BY COORDINATES

print("Enter the coordinates of first point")
x1=float(input("X = "))
y1=float(input("Y = "))
print("Enter the coordinates of second point")
x2=float(input("X = "))
y2=float(input("Y = "))
print("Enter the coordinates of third point")
x3=float(input("X = "))
y3=float(input("Y = "))
a=(0.5)*(abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)))
if a==0:
    print("The points are collinear")
else:
    print("The area of the triangle =",a)

Friday, April 14, 2023

AVERAGE ERROR FOR 5 OR 10 READINGS ONLY

print("How many readings will you enter 5 or 10?")
n=int(input("Enter the number of readings = "))
if n==5:
    r1=float(input("Enter the value of first reading = "))
    r2=float(input("Enter the value of second reading = "))
    r3=float(input("Enter the value of third reading = "))
    r4=float(input("Enter the value of fourth reading = "))
    r5=float(input("Enter the value of fifth reading = "))
    r=(r1+r2+r3+r4+r5)/5
    mar=(abs(r-r1)+abs(r-r2)+abs(r-r3)+abs(r-r4)+abs(r-r5))/5
    re=mar/r
    rpe=(mar/r)*100
    print("Average error =",r)
    print("Mean Absolute error =",mar)
    print("Relative error =",re)
    print("Percentage error =",rpe)
elif n==10:
    r1=float(input("Enter the value of first reading = "))
    r2=float(input("Enter the value of second reading = "))
    r3=float(input("Enter the value of third reading = "))
    r4=float(input("Enter the value of fourth reading = "))
    r5=float(input("Enter the value of fifth reading = "))
    r6=float(input("Enter the value of sixth reading = "))
    r7=float(input("Enter the value of seventh reading = "))
    r8=float(input("Enter the value of eighth reading = "))
    r9=float(input("Enter the value of ninth reading = "))
    r10=float(input("Enter the value of tenth reading = "))
    r=(r1+r2+r3+r4+r5+r6+r7+r8+r9+r10)/10
    mar=(abs(r-r1)+abs(r-r2)+abs(r-r3)+abs(r-r4)+abs(r-r5)+abs(r-r6)+abs(r-r7)+abs(r-r8)+abs(r-r9)+abs(r-r10))/10
    re=mar/r
    rpe=(mar/r)*100
    print("Average error =",r)
    print("Mean Absolute error =",mar)
    print("Relative error =",re)
    print("Percentage error =",rpe)
else:
    print("Kindly take 5 or 10 readings only.")

VELOCITY OF A PISTON

import math as m
r=float(input("Enter the radius of the crankshaft = "))
l=float(input("Enter the length of connecting rod = "))
print("Enter the crankshaft angle")
A=float(input(""))
N=float(input("Enter the number of revolutions per minute = "))
V=2*3.14*N*r*(m.sin(A)+(r/l)*(m.sin(A))*(m.cos(A))+(1/2)*(r/(l**3)*((m.sin(A))**3)*m.cos(A)))
print("The velocity of the piston =",V)

LENGTH OF BELT COVERING TWO PULLEYS

import math as m
D=float(input("Enter the diameter of the bigger pulley = "))
d=float(input("Enter the diameter of the smaller pulley = "))
C=float(input("Enter the distance between the two pulleys = "))
L=(4*(C**2)-(D-d)**2)**0.5+(3.14*(D+d)/2+(D-d)*(m.asin((D-d)/2*C)))
print("The length of the belt needed to wrap around two pulleys =",L)

FINDING HORIZONTAL RANGE

import math as m
v=float(input("Enter the initial velocity in m/s = "))
print("Enter the value of Θ in sinΘ")
s=float(input(""))
print("Enter the value of Θ in cosΘ")
c=float(input(""))
r=(v**2*(m.sin(s))*(m.cos(c)))/9.814
print("The Horizontal range = ",r)

PERIOD OF A PENDULUM

import math as m
l=int(input("Enter the pendulum length in cm = "))
print("Enter the angle of displacement")
a=int(input(""))
g=980
p=(2*(3.14)*(l/g)**1)/(2*(1/4*(m.sin(a/2)**2)+1))
print("The period of a pendulum =",p)

ARITHEMETIC OPERATIONS ON ERROR

a=float(input("Enter the first reading = "))
b=float(input("Enter the error in first reading = "))
e=float(input("Enter the power of the first reading = "))
c=float(input("Enter the second reading = "))
d=float(input("Enter the error in second reading = "))
f=float(input("Enter the power of the second reading = "))
print("The sum of the readings =",a+c,"±",b+d)
print("The difference of the readings =",abs(a-c),"±",b+d)
p=(a*c)*((b/a)+(d/c))
print("The product of the two readings =",a*c,"±",p)
q=(a/c)*((b/a)+(d/c))
print("The division of the two readings =",a/c,"±",q)
m=e*(b/a)*100+f*(d/c)*100
print("The power error of two readings =",m,"%")

ALT CODES

Sunday, April 9, 2023

TEST-1

 QUESTIONS OF THE TEST


ANSWERS OF PROGRAMS
QUES-11
QUES-12
QUES-13
QUES-14
QUES-15

HOME ELECTRIC BILL UPTO 5 DEVICES

print("Enter the details of first application")
p1=int(input("Enter the power in Watt = "))
t1=int(input("Enter the number of hours used = "))
n1=int(input("Enter the number of application = "))
print("Enter the details of second application")
p2=int(input("Enter the power in Watt = "))
t2=int(input("Enter the number of hours used = "))
n2=int(input("Enter the number of application = "))
print("Enter the details of third application")
p3=int(input("Enter the power in Watt = "))
t3=int(input("Enter the number of hours used = "))
n3=int(input("Enter the number of application = "))
print("Enter the details of fourth application")
p4=int(input("Enter the power in Watt = "))
t4=int(input("Enter the number of hours used = "))
n4=int(input("Enter the number of application = "))
print("Enter the details of fifth application")
p5=int(input("Enter the power in Watt = "))
t5=int(input("Enter the number of hours used = "))
n5=int(input("Enter the number of application = "))
e1=(p1*0.001)*t1*n1
e2=(p2*0.001)*t2*n2
e3=(p3*0.001)*t3*n3
e4=(p4*0.001)*t4*n4
e5=(p5*0.001)*t5*n5
e=e1+e2+e3+e4+e5
if e<200:
    print("no bill")
elif 200<e<301:
    print("Your bill for 1 day =",e*5+((e*5)*0.025),"\n","Your bill for 30 days =",(e*5)*30+(((e*5)*30)*0.025),"\n","Your bill for 31 days =",(e*5)*31+(((e*5)*31)*0.025),"\n")
elif 300<e<401:
    print(e*7+((e*7)*0.025),"\n","Your bill for 30 days =",(e*7)*30+(((e*7)*30)*0.025),"\n","Your bill for 31 days =",(e*7)*31+(((e*7)*31)*0.025),"\n")
elif 400<e:
    print(e*8.5+((e*8.5)*0.025),"\n","Your bill for 30 days =",(e*8.5)*30+(((e*8.5)*30)*0.025),"\n","Your bill for 31 days =",(e*8.5)*31+(((e*8.5)*31)*0.025),"\n")

FINDING COORDINATES OF TRIANGLE THROUGH COORDINATES OF MIDPOINTS

print("Enter the coordinates of midpoint of AB")
x1=int(input("x1 of midpoint = "))
y1=int(input("y1 of midpoint  = "))
print("Enter the coordinates of midpoint of BC")
x2=int(input("x2 of midpoint = "))
y2=int(input("y3 of midpoint  = "))
print("Enter the coordinates of midpoint of AC")
x3=int(input("x3 of midpoint = "))
y3=int(input("y3 of midpoint  = "))
X1=x1+x3-x2
Y1=y1+y3-y2
X2=x1+x2-x3
Y2=y1+y2-y3
X3=x2+x3-x1
Y3=y2+y3-y1
print("\n",'       A',"(",X1,",",Y1,")")
print('        /\ ')
print('       /  \ ')
print('      /    \ ')
print('     /      \ ')
print('    /        \ ')
print('   /          \ ')
print('  /            \ ')
print(' /______________\ ')
print('B','              C')
print("(",X2,",",Y2,")","   ","(",X3,",",Y3,")")
print("\n","Midpoint of AB =(",x1,",",y1,")")
print("","Midpoint of BC =(",x2,",",y2,")")
print("","Midpoint of AC =(",x3,",",y3,")")
print("The coordinates of A = (",X1,",",Y1,")")
print("The coordinates of B = (",X2,",",Y2,")")
print("The coordinates of C = (",X3,",",Y3,")")

FINDING THE PYTHAGOREAN TRIPLETS

m=int(input("Enter the digit = "))
while m!=0:
    if (2*m)%10==0:
        print("The triplets are",2*m,(m**2)-1,(m**2)+1,end="")
        break
    elif ((m+1)**0.5)%2==0:
        print("The triplets are",2*m,(m**2)-1,(m**2)+1,end="")
        break
    elif ((m-1)**0.5)%2==0:
        print("The triplets are",2*m,(m**2)-1,(m**2)+1,end="")
        break
    else:
        print("No pythagorean triplets possible",end="")

OCTAL NUMBER TO BINARY NUMBER

n=int(input("Enter the octal number = "))
s=('000','001','010','011','100','101','110','111')
while n!=0:
    d=n%10
    print(s[d],end="")
    n=n//10

SLICING THE EVEN DIGITS OF A NUMBER

n=int(input("Enter a five digit number = "))
while n!=0:
    d=n%10
    n=n//10
    if d%2==0:
        print(end="")
    else:
        print(d,end="")

OCTAL NUMBER TO BINARY NUMBER

n=int(input("Enter the octal number = "))
s=['000','001','010','011','100','101','110','111']
while n!=0:
    d=n%10
    print(s[d],end="")
    n=n//10

DECIMAL NUMBER TO HEXADECIMAL NUMBER

n=int(input("Enter the decimal number = "))
while n!=0:
    d=n%16
    n=n//16
    if d==10:
        print("A",end="")
    elif d==11:
        print("B",end="")
    elif d==12:
        print("C",end="")
    elif d==13:
        print("D",end="")
    elif d==14:
        print("E",end="")
    elif d==15:
        print("F",end="")
    else:
        print(d,end="")

DECIMAL NUMBER TO OCTAL NUMBER

n=int(input("Enter the decimal number = "))
while n!=0:
    d=n%8
    print(d,end="")
    n=n//8
#The OUTPUT number is to be reversed for eg: (144)base16 = (220)base8 but in program the result appears (022)base8

DECIMAL NUMBER TO BINARY NUMBER

n=int(input("Enter the decimal number = "))
while n!=0:
    d=n%2
    print(d,end="")
    n=n//2
#The number is to be reversed for eg: (144)base16 = (10010000)base2 but in program the result appears (00001001)base2

THE SUM OF NUMBER ENTERED AND ITS REVERSED NUMBER

n=int(input("Enter the number = "))
k=n
q1=n//1000
n=n%1000
q2=n//100
n=n%100
q3=n//10
n=n%10
q4=n//1
n=n%1
p=q4*1000+q3*100+q2*10+q1
print("The reversed number =",q4*1000+q3*100+q2*10+q1)
print("The sum of number and the reversed number =",(k+p))

THE SUM OF DIGITS OF NUMBER ENTERED

n=int(input("Enter the number = "))
q1=n//1000
n=n%1000
q2=n//100
n=n%100
q3=n//10
n=n%10
q4=n/1
n=n%1
print("The sum of digits of number enetered =",q1+q2+q3+q4)

Thursday, April 6, 2023

ZEROES OF A CUBIC POLYNOMIAL

print("Enter the values in the form of ax^3+bx^2+cx+d")
a=int(input("Enter the value of a = "))
b=int(input("Enter the value of b = "))
c=int(input("Enter the value of c = "))
d=int(input("Enter the value of d = "))
e=int(input("Enter one of the zeroes = "))
p=d+(e*c)+((e**2)*b)+a*(e**3)
x1=(-b-(a*e)+(((b+(a*e))**2)-(4*a*c+(4*a*e*b)+(4*(a**2)*(e**2))))**0.5)/(2*a)
x2=(-b-(a*e)-(((b+(a*e))**2)-(4*a*c+(4*a*e*b)+(4*(a**2)*(e**2))))**0.5)/(2*a)
print("the zeroes of the polynomial are =",x1,",",x2,"&",e)

SIMPLE INTEREST(SI) AND COMPOUND INTEREST(CI) QUARTERLY,HALF YEARLY AND ANNUALLY

p=int(input("Enter the principal amount = "))
r=int(input("Enter the rate of interest = "))
t=int(input("Enter the time = "))
si=(p*r*t)/100
a=p*((1+(r/0.01))**t)
ci=a-p
print("The Simple Interest for quarter =",si/4)
print("The Compound Interest for quarter =",ci/4)
print("The Simple Interest for half year =",si/2)
print("The Compound Interest for half year =",ci/2)
print("The Simple Interest for annual =",si/1)
print("The Compound Interest for annual =",ci/1)

AREA OF A QUADILATERAL USING SARRUS METHOD

print("Enter the coordinates of point A")
x1=int(input("X = "))
y1=int(input("Y = "))
print("Enter the coordinates of point B")
x2=int(input("X = "))
y2=int(input("Y = "))
print("Enter the coordinates of point C")
x3=int(input("X = "))
y3=int(input("Y = "))
print("Enter the coordinate of point D")
x4=int(input("X = "))
y4=int(input("Y = "))
A=(abs(x1*(y2-y4)+x2*(y3-y1)+x3*(y4-y2)+x4*(y1-y3)))*0.5
print("(",x1,",",y1,")"," ","(",x2,",",y2,")")
print(' A____________B')
print(' |            |')
print(' |            |')
print(' |            |')
print(' C____________D',)
print("(",x3,",",y3,")"," ","(",x4,",",y4,")")
print("\n","Area of the quadilateral =",A)

AREA OF TRIANGLE USING SARRUS METHOD

print("Enter the coordinates of point A")
x1=int(input("X = "))
y1=int(input("Y = "))
print("Enter the coordinates of point B")
x2=int(input("X = "))
y2=int(input("Y = "))
print("Enter the coordinates of point C")
x3=int(input("X = "))
y3=int(input("Y = "))
print("\n",'       A',"(",x1,",",y1,")")
print('        /\ ')
print('       /  \ ')
print('      /    \ ')
print('     /      \ ')
print('    /        \ ')
print('   /          \ ')
print('  /            \ ')
print(' /______________\ ')
print('B','              C')
print("(",x2,",",y2,")","   ","(",x3,",",y3,")")
print("\n","The coordinates of A =(",x1,",",y1,")")
print("\n","The coordinates of B =(",x2,",",y2,")")
print("\n","The coordinates of C =(",x3,",",y3,")")
A=abs((x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))*0.5)
print("\n","The area of triangle ABC =",A,"sq. units")

ELECTRICITY BILL

print("Enter the details of first appliance","\n")
p1=int(input("Enter the power of appliance in Watt = "))
n1=int(input("Enter the number of appliance in houses = "))
t1=int(input("Enter the number of hours used = "))
print("\n","Enter the details of second appliance")
p2=int(input("Enter the power of appliance in Watt = "))
n2=int(input("Enter the number of appliance in houses = "))
t2=int(input("Enter the number of hours used = "))
print("\n","Enter the details of third appliance")
p3=int(input("Enter the power of appliance in Watt = "))
n3=int(input("Enter the number of appliance in houses = "))
t3=int(input("Enter the number of hours used = "))
print("\n","Enter the details of fourth appliance")
p4=int(input("Enter the power of appliance in Watt = "))
n4=int(input("Enter the number of appliance in houses = "))
t4=int(input("Enter the number of hours used = "))
print("\n","Enter the details of fifth appliance")
p5=int(input("Enter the power of appliance in Watt = "))
n5=int(input("Enter the number of appliance in houses = "))
t5=int(input("Enter the number of hours used = "))
e1=n1*(p1*0.001)*t1
e2=n2*(p2*0.001)*t2
e3=n3*(p3*0.001)*t3
e4=n4*(p4*0.001)*t4
e5=n5*(p5*0.001)*t5
print("\n","Total electricity consumed =",e1+e2+e3+e4+e5,"KwH")
print("\n","Total cost for 1 day =",(e1+e2+e3+e4+e5)*5)
print("\n","Total cost for 30 days =",((e1+e2+e3+e4+e5)*5)*30)
print("\n","Total cost for 31 days =",((e1+e2+e3+e4+e5)*5)*31)

ARITHEMATIC OPERATIONS ON COMPLEX NUMBER

print("Enter the first number in the form of a + ib")
a=int(input("Enter the value of a = "))
b=int(input("Enter the value of b = "))
print("Enter the second numebr in the form of c + id")
c=int(input("Enter the value of c = "))
d=int(input("Enter the value of d = "))
print("\n","The addition of two numbers = (a+c) + i(b+d)")
print("The number is =",a+c,"+","i",b+d)
print("\n","The subtraction of two numbers = (a-c) + i(b-d)")
print("The number is =",a-c,"+ i",b-d)
print("\n","The product of two numbers is = (ac-bd) + i(ad+bd)")
print("The number is =",a*c-b*d,"+ i",a*d+b*c)
print("\n","The division of two numbers = (ac-bd) + i(ad +bc)")
print("                              --------------------")
print("                                  c^2   +  d^2 ")
print("The number is =",a*c-b*d,"+ i",a*d+b*c)
print("                ---------")
print("                   ",c**2+d**2,"   ")

RESULT CALCULATOR IN PERCENTAGE

n=input("Enter your name = ")
s1=(input("Enter the name of first subject = "))
m1=int(input("Enter the value of first subject = "))
s2=(input("Enter the name of second subject = "))
m2=int(input("Enter the value of second subject = "))
s3=(input("Enter the name of third subject = "))
m3=int(input("Enter the value of third subject = "))
s4=(input("Enter the name of fourth subject = "))
m4=int(input("Enter the value of fourth subject = "))
s5=(input("Enter the name of fifth subject = "))
m5=int(input("Enter the value of fifth subject = "))
p=(m1+m2+m3+m4+m5)/5
print("------------------------------")
print("|Name of subject|Marks scored|")
print("|  ",s1,"       |","  ",m1," |")
print("|  ",s2,"       |","  ",m2," |")
print("|  ",s3,"       |","  ",m3," |")
print("|  ",s4,"       |","  ",m4," |")
print("|  ",s5,"       |","  ",m5," |")
print("------------------------------","\n")
print("______________________________")
print("|                            |")
print("|      ________________       |")
print("|      |              |       |")
print("|      |","Hello",n,"!|       |")
print("|      |______________|       |")
print("|                            |")
print("|                            |")
print("|----------------------------|")
print("|   _____________________    |")
print("|   |                   |    |")
print("|   |percenatge =",p,"%|","   |")
print("|   |___________________|    |")
print("|____________________________|")

EXPONENTIAL POWER

b=int(input("Enter the value of base = "))
n=int(input("Enter the value of the exponent = "))
print("The value of power of base =",b**n)

OUTPUT



HYPOTENUSE OF A RIGHT TRIANGLE

p=int(input("Enter the value of perpendicular of right triangle = "))
b=int(input("Enter the value of base of right triangle = "))
h=((p**2)+(b**2))**0.5
print(' A         ')
print(' .          ')
print(' . .        ')
print(' .  .       ')
print(' .   .      ')
print(' .    .     ')
print(' .     .    ')
print(' .      .   ')
print(' . . . . .  ')
print(' B','      C',"\n")
print("The hypotenuse of the triangle =",h,"units")

AREA OF A QUADILATERAL THROUGH HERON'S FORMULA

print("Enter the sides and diagonal of quadilaterals")
s1=int(input("Enter the side AB = "))
s2=int(input("Enter the side BC = "))
s3=int(input("Enter the side CD = "))
s4=int(input("Enter the side AD = "))
s5=int(input("Enter the diagonal AC = "))
S1=(s1+s2+s5)/2
S2=(s3+s4+s5)/2
a1=(S1*(S1-s1)*(S1-s2)*(S1-s5))**0.5
a2=(S2*(S2-s3)*(S2-s4)*(S2-s5))**0.5
a=a1+a2
print('A____________B')
print('|                            |')
print('|                            |')
print('|                            |')
print('D____________C',"\n")
print("Length of AB =",s1)
print("Length of BC =",s2)
print("Length of CD =",s3)
print("Length of AD =",s4)
print("Length of AC =",s5)
print("\n","Area of triangle ABC =",a1)
print("\n","Area of triangle BCD =",a2)
print("\n","Area of ABCD =",a)

MEAN COST OF ARTICLES

a1=input("Enter the name of first article = ")
c1=int(input("Enter the cost of first article = "))
a2=input("Enter the name of second article = ")
c2=int(input("Enter the cost of second article = "))
a3=input("Enter the name of third article = ")
c3=int(input("Enter the cost of third article = "))
a4=input("Enter the name of fourth article = ")
c4=int(input("Enter the cost of fourth article = "))
a5=input("Enter the name of fifth article = ")
c5=int(input("Enter the cost of fifth article = "))
m=(c1+c2+c3+c4+c5)/5
print("-----------------------")
print("|Name ofArticle| Cost |")
print("|        ",a1,"       |",c1," |")
print("|        ",a2,"       |",c2," |")
print("|        ",a3,"       |",c3," |")
print("|         ",a4,"      |",c4," |")
print("|         ",a5,"      |",c5," |")
print("-----------------------")
print("Mean costs of article =",m)

Sunday, April 2, 2023

TEXT TO MORSE CODE(USING HYPHEN AND DOT)

m=input("Enter the text = ")
for x in m:
    if x=='A' or x=='a':print(".- ",end="")
    elif x=='B' or x=='b':print("-... ",end="")
    elif x=='C' or x=='c':print("-.-. ",end="")
    elif x=='D' or x=='d':print("-.. ",end="")
    elif x=='E' or x=='e':print(". ",end="")
    elif x=='F' or x=='f':print("..-. ",end="")
    elif x=='G' or x=='g':print("--. ",end="")
    elif x=='H' or x=='h':print(".... ",end="")
    elif x=='I' or x=='i':print(".. ",end="")
    elif x=='J' or x=='j':print(".--- ",end="")
    elif x=='K' or x=='k':print("-.- ",end="")
    elif x=='L' or x=='l':print(".-.. ",end="")
    elif x=='M' or x=='m':print("-- ",end="")
    elif x=='N' or x=='n':print("-. ",end="")
    elif x=='O' or x=='o':print("--- ",end="")
    elif x=='P' or x=='p':print(".--. ",end="")
    elif x=='Q' or x=='q':print("--.- ",end="")
    elif x=='R' or x=='r':print(".-. ",end="")
    elif x=='S' or x=='s':print("... ",end="")
    elif x=='T' or x=='t':print("- ",end="")
    elif x=='U' or x=='u':print("..- ",end="")
    elif x=='V' or x=='v':print("...- ",end="")
    elif x=='W' or x=='w':print(".-- ",end="")
    elif x=='X' or x=='x':print("-..- ",end="")
    elif x=='Y' or x=='y':print("-.-- ",end="")
    elif x=='Z' or x=='z':print("--.. ",end="")
    elif x==' ':print("/",end="")
    elif x=='.':print(".-.-.- ",end="")
    elif x=='?':print("..--.. ",end="")
    elif x=='!':print("-.-.-- ",end="")
    elif x==';':print("-.-.-. ",end="")
    elif x==',':print("--..-- ",end="")
    elif x==':':print("---... ",end="")
    elif x=='+':print(".-.-. ",end="")
    elif x=='-':print("-....- ",end="")
    elif x=='/':print("-..-. ",end="")
    elif x=='=':print("-...- ",end="")
    elif x=='1':print(".---- ",end="")
    elif x=='2':print("..--- ",end="")
    elif x=='3':print("...-- ",end="")
    elif x=='4':print("....- ",end="")
    elif x=='5':print("..... ",end="")
    elif x=='6':print("-.... ",end="")
    elif x=='7':print("--... ",end="")
    elif x=='8':print("---.. ",end="")
    elif x=='9':print("----. ",end="")
    elif x=='0':print("----- ",end="")
    elif x=='(':print("-.--. ",end="")
    elif x==')':print("-.--.- ",end="")
    elif x=='&':print(".-... ",end="")
    elif x=='"':print(".-..-. ",end="")
    elif x=='$':print("...-..- ",end="")
    elif x=='@':print(".--.-. ",end="")
    elif x=='_':print("..--.- ",end="")