Problem No.
1 Date: m1 = int(input("Enter the Mark in Subject1 : "))
Write a Python Program to convert Centimeters into Inches and Feet. m2 = int(input("Enter the Mark in Subject2 : "))
m3 = int(input("Enter the Mark in Subject3 : "))
centi = float(input("Enter the height in Centimeters : "))
inches = round(0.3937 * centi,0) m4 = int(input("Enter the Mark in Subject4 : "))
ft = round(inches/12,2) m5 = int(input("Enter the Mark in Subject5 : "))
print("Height in Feet = ",ft) print("Height in Inches sum =m1+m2+m3+m4+m5 avg = sum/5
",inches) if avg>100:
grade = "Error"
Problem No. 2 Date: elif avg>=90: grade =
Write a Python Program to find the given three digit number is ARMSTRONG Number or 'O' elif avg>=80: grade
Not. = 'A' elif avg>=70:
grade = 'B' elif avg>=60:
grade = 'C' elif avg>=50:
sum =0
grade = 'D' else: grade
num=int(input("Enter a number : "))
= 'E'
n1 = num
print("\nThe Subject Marks are : ", end = "")
while num != 0:
print(m1,m2,m3,m4,m5,sep=",") print("Average : ",avg)
r1 = num%10
print("The grade is : ",grade)
sum = sum + r1**3
Problem No. 5 Date:
num=num//10
Write a Python script to input two numbers and print their LCM (Least Common Multiple)
if n1==sum:
and GCD (Gretest Common Divisor).
print("The number ",n1," is an ARMSTRONG number") else:
print("The number ",n1," is not an ARMSTRONG number")
x = int(input("Enter first number : "))
y = int(input("Enter second number : "))
Problem No. 3 Date:
smaller = x if x < y else y
Write a Python Program to calculate Simple and Compound Interest.
for i in range(1, smaller + 1): if((x % i == 0)
and (y % i == 0)):
S.I. C.I. = hcf = i lcm = (x * y) / hcf print("The H.C.F. of", x,
"and", y, "is", hcf) print("The L.C.M. of", x, "and", y, "is",
p=float(input("Enter the Principle Amount :")) lcm)
r=float(input("Enter the Rate of Interest (per Month) :")) Problem No. 6 Date:
t=float(input("Enter the Time Duration (in Months) : ")) Write a Python Program to calculate and print roots of a quadratic equation : ax2 + bx + c
si = p* r * t/100 = 0 (a≠0)
ci = p*(1+r/100)**t - p
print("Simple Interest : ",chr(0x20B9),round(si,2))
print("Compound Interest : ",chr(0x20B9),round(ci,2)) import math print("For Quadratic Equation, ax**2+bx+c=0, enter the
Problem No. 4 Date: coefficients below ")
Write a Python Program to get five subject marks and find the grade according to the table a=int(input("Enter a : ")) b=int(input("Enter b : "))
given below. c=int(input("Enter c : "))
Average Grade
if a==0:
>=90 O
print("Value of ",a,' should not be zero')
>=80 A print("Aborting!!!") else:
>=70 B delta = b*b - 4*a*c if delta >
0:
>=60 C
root1 = ( - b + math.sqrt(delta)) / (2 * a) root2 = (-b -
>=50 D
math.sqrt(delta)) / (2 * a) print ("Roots are REAL and
<50 E UNEQUAL") print ("Root1 = ", root1, ", Root2 = ", root2)
elif delta == 0:
root1 = - b / (2 * a); range(5,-1,- 1)
print ("Roots are REAL and EQUAL") : for j in range(i):
print ("Root1 = ", root1, ", Root2 = ", root1) else : print(chr(ch),end=" ")
print ("Roots are COMPLEX and IMAGINARY") ch+=2
start = start+1
Problem No. 7 Date: ch=start
Write a Python Program to find the factorial of a given number using function print()
Problem No. 10 Date:
def facto(n): Write a Python Program to find the factors of a given number using while loop.
f=1
for i in range(1,n+1): n=int(input("Enter an integer : ")) print("Factors are : ")
f *= i i=2
return f while i<n:
num=int(input("Enter a number to find the Factorial : ")) if n%i==0:
fac = facto(num) print(i)
print("Factorial of ",num," is ",fac) i+=1
Problem No. 11 Date:
Write a Python Program to find the given string is PALINDROME or NOT.
Problem No. 8 Date:
Write a Python Program to find the sum of the following series : string = input("Enter any string: ") rev=""
for i in range(len(string)-1,-1,-1):
rev = rev+string[i]
print("TO FIND THE SUM OF SERIES OF X-X^3/3!+X^5/5!+...")
print("Reversed String : ",rev)
x= int(input("Enter the value of x : "))
if rev == string:
n = int(input("Enter the value of n : "))
print("The string is PALINDROME") else:
a = 1 sum_series = 0
print("The string is NOT PALINDROME")
for i in range(1,n+1,2):
fact=1
Problem No. 12 Date:
for j in range(1,i+1):
Write a Python Program to count the following in the given string:
fact *=j
sum_series += x**i*a/fact (i) Number of two letter words
a *= -1 (ii) Number of Capital Letters
(iii) Number of Small Letters
print("The sum of the series is :",sum_series)
string = input("Enter the text : ")
Problem No. 9 Date:
word_cnt=upper_cnt=lower_cnt=0 words =
Write a Python Program to print the following pattern:
string.split(" ")
C EGIK for i in words:
DFHJ if len(i)==2:
E GI word_cnt += 1
F H for i in string:
G if i.isupper():
#Printing the Pattern ch = upper_cnt += 1
67 start = ch for i in
elif i.islower(): Problem No. 15 Date:
lower_cnt+=1 Write a Python Program to create a Dictionary with the count frequency of the
print("Count of TWO letter Words : ",word_cnt) elements of the given List.
print("Upper Case Letters : ",upper_cnt)
L = eval(input("Enter the numbers of the list : "))
print("Lower Case Letters : ",lower_cnt)
dict_cnt = {}
temp_List = []
Problem No. 13 Date: cnt = 0 while True:
Write a Python Program to find the biggest and smallest numbers in the if len(L)!=0:
List. n = L[0]
dict_cnt[n]= L.count(n)
L = eval(input("Enter the LIST of numbers : ")) for i in range(L.count(n)):
L.remove(n)
small = L[0] big =
else:
L[0]
break
for i in range(1,len(L)):
if L[i]<small: print("The dictionary with the count of frequency of \ elements of the
small = L[i] list is : \n",dict_cnt)
if L[i]>big:
big = L[i] Problem No. 16 Date:
Write a Python Program to create a List of Tuples contains the given List
print("The biggest number of the list is :",big) print("The smallest of numbers and their cubs.
number of the list is :",small)
List = eval(input("Enter the numbers of the List :
new_List = []
Problem No. 14 Date:
Write a Python Program to classify the numbers of a LIST as Prime or Composite.
for i in List:
tup = (i,i**3)
L = eval(input("Enter the Numbers in the LIST : ")) print("List of Tuples with the number and its cube:",new_List)
prime = composite =""
f=0
for i in L: lim = i//2 for j in
range(2,lim+1):
if i%j==0:
composite += str(i)+","
f=1
break
if f!=1:
prime += str(i)+","
f=0
print("The prime numbers are ",prime) print("The
composite numbers are ",composite)