1) *Simple Interest*:
p=int(input("Enter the Principal
amount: ")) r=int(input("Enter the Rate
of interest: ")) t=int(input("Enter the
period of interest: ")) SI=p*r*t/100
print("The amount of interest after
",t,"years is",SI) print("The total
amount after ",t,"years is",SI+p)
2) *Area of rectangle*:
l=int(input("Enter the length of the
rectangle: ")) b=int(input("Enter the
breadth of the rectangle: ")) A=l*b
print("The area of the rectangle is",A,"
Square units.")
3) *Area of triangle*:
h=int(input("Enter the height of the
Triangle: ")) b=int(input("Enter the
breadth of the Triangle: ")) A=1/2*h*b
print("The area of the triangle is",A,"
Square units.")
4)*Average of three
subjects*:
a=int(input("Enter the marks of the
first subject: ")) b=int(input("Enter
the marks of the second subject: "))
c=int(input("Enter the marks of the
third subject: ")) A=1/3*(a+b+c)
print("The average of three subjects",A)
5)*Discounted amount*:
a=int(input("Enter the discount
percentage: ")) b=int(input("Enter
the original price: ")) fp=(100-
a)*b/100 print("The final price
is",fp)
6) *Vote criteria*:
a=int(input("Enter the
persons age: ")) if a>=18:
print("You are eligible
to vote") else: ("You
are not eligible")
7)*Largest number*:
num1 = int(input("Enter the first
number: ")) num2 = int(input("Enter
the second number: ")) num3 =
int(input("Enter the third number:
"))
if (num1 >= num2) and (num1
>= num3):
largest = num1 elif
(num2 >= num1) and (num2 >=
num3):
largest = num2 else:
largest = num3 print("The
largest number is:", largest)
8) *Grade of a student*:
a=int(input("Enter the
English marks: "))
b=int(input("Enter the Hindi
marks: ")) c=int(input("Enter
the Maths marks: "))
d=int(input("Enter the
Science marks: "))
e=int(input("Enter the Social
marks: ")) f=
int(input("Enter maximum
marks:"))
average_marks=(a+b+c+d+e)/5
if 90 <= average_marks <=
100:
grade = "A" elif
80 <= average_marks <
90:
grade = "B" elif
70 <= average_marks <
80:
grade = "C" elif
60 <= average_marks <
70:
grade =
"D" else:
grade = "F" p=average_marks*100/f
print("You have secured",p," % and
",grade," grade .")
9) *Positive negative or
zero*:
a=float(input("Enter the
number: ")) if a>0:
print(a," is
positive.") elif a<0:
print(a," is
negative.") else:
print("Your number is
zero")
10) *Print n natural nos.*:
a=int(input("Enter the
number: ")) for i in
range(1,(a+1),1):
print(i)
11) *Print n even nos.*:
a=int(input("Enter the
number: ")) for i in
range(2,2*(a)+1,2):
print(i)
12)*Print n odd nos.*:
a=int(input("Enter the
number: ")) for i in
range(1,2*(a)+1,2):
print(i)
13) *Fibonacci series*:
a=0 b=1
n=float(input("Enter an
integer: "))
print("Fibonacci series:")
if n<=0:
print("Please enter a
positive integer.") else:
x=0 while x<n:
print(a) m=a+b
a=b b=m x=x+1
14) *Factorial*:
a=int(input("Enter the
no.: ")) f=1 for i in
range(1, a+1): f=
f*i print("The
factorial is",f)
15) *Sum of n numbers*:
a=int(input("Enter the
no.: ")) f=0 for i in
range(1, a+1): f=
f+i print("The sum
is",f)
16) *Palindrome*:
n=int(input("Enter a number to check if it's
a palindrome: ")) og=n r=0 while n>0: l=n
%10 r=(r*10)+l n=n//10 if og==r:
print("Yes, the number is a
palindrome!") else:
print("No, it is not a
palindrome.")
17) *Reverse number*:
n=int(input("Enter a
number to reverse: "))
og=n r=0 while n>0:
l=n%10 r=(r*10)+l
n=n//10 print("The
reverse number is ",r)
18)*Sum of Square of n
number*:
n=int(input("Enter the
number: ")) k=0 i=1 if
i>0: for i in
range(1,n+1,1):
j=i*ik=k+j
print(k)
19) *Stars*: I) Ascending
rows = 0
for i in range(rows, 5,
1): for j in
range(i):
print("*", end=" ")
print()
ii) Descending rows
= 5 for i in
range(rows, 0, -1):
for j in range(i):
print("*", end=" ")
print()