CLASS 11 PRACTICAL PROGRAM LIST:
1. Multiple Print Methods
Aim:
Program to print the data in same line and line by line
Algorithm:
1. Start
2. Printing text as per the requirement.
3. Stop
Source Code:
print("Hai Good morning")
print("--------")
print("Hai", "Good", "morning",sep=" # ")
print("--------")
print("Hai", "Good", "morning",sep="\n")
Output
Hai Good morning
--------
Hai # Good # morning
--------
Hai
Good
morning
Result:
Program executed successfully and obtained the required result.
***********
2. Input Methods
Aim: Program to use various input methods.
Algorithm:
1. Start
2. Accepting input as integer, real, text and other objects.
3. Stop
Source Code:
print("Hai try various input and print methods")
print("--------")
num1=int(input("Enter a numeric value eg : 25,68,125 etc "))
print("The numeric value accepted using int() function is :- ",num1)
print("--------")
num2=float(input("Enter a decimal value eg : 25.6,68.0,125.23 etc "))
print("The floating point value accepted using float() function is :- ",num2)
print("--------")
num3=eval(input("Enter a numeric/decimal value eg : 25,68.0,125.23 etc "))
print("The real/float point value accepted using eval() function is :-",num3)
print("--------")
data=input("Enter a string value eg : AJEY, Trivandrum :- ")
print("The string value accepted using input() function is :- ",data)
print("--------")
Output
Hai try various input and print methods
--------
Enter a numeric value eg : 25,68,125 etc 45
The numeric value accepted using int() function is :- 45
--------
Enter a decimal value eg : 25.6,68.0,125.23 etc 69.3
The floating point value accepted using float() function is :- 69.3
--------
Enter a numeric/decimal value eg : 25,68.0,125.23 etc 49
The real/floating point value accepted using eval() function is :- 49
--------
Enter a string value eg : AJEY, Trivandrum :- amith
The string value accepted using input() function is :- amith
--------
Result:
Program executed successfully and obtained the required result.
3. CELSIUS TO FAHRENHEIT
Aim: Program to convert Temperature in Celsius to Fahrenheit
Algorithm:
1. Start
2. Accept input temperature Celsius value.
3. Finding equivalent Fahrenheit value using the formula F=cels*9/5+32.
4. Display the Fahrenheit value.
5. Stop
Source Code:
cels=float(input("Enter the temperature in Celsius :- "))
print("The temperature given in Celsius is : - ",cels," Degree Celsius")
F=cels*9/5+32
print("The temperature converted to Fahrenheit is : - ",F," Fahrenheit")
Output
Enter the temperature in Celsius :- 15
The temperature given in Celsius is : - 15.0 Degree Celsius
The temperature converted to Fahrenheit is : - 59.0 Fahrenheit
Result:
Program executed successfully and obtained the required result.
***********
4. Minutes into Hours & Minutes
Aim: Program to convert Minutes into Hours & Minutes
Algorithm:
1. Start
2. Accept minutes.
3. Convert minutes into hours and minutes using modulus and floor division
operators.
4. Display output
5. Stop
Source Code:
min=int(input("Enter the time in Minutes :- "))
Hours=min//60
Minutes=min%60
print("hours in" ,min, "minutes is :- ", Hours)
print("Balance" ,min, "minutes is :- ", Minutes)
Output
Enter the time in Minutes :- 125
hours in 125 minutes is :- 2
Balance 125 minutes is :- 5
Result:
Program executed successfully and obtained the required result.
***********
5. Currency denomination
Aim: Program to find the total number of currency notes of each denomination.
Algorithm:
1. Start
2. Input the amount.
3. Finding denomination using Floor division and Modulus operators
4. Display the denomination in hundreds, fifties and tens.
5. Stop
Program:
amt = int(input("Enter the Amount to be Withdrawn :"))
hundred = amt//100
amt = amt%100
fifty = amt//50
amt = amt%50
ten = amt//10
print("No of Hundred Notes :",hundred)
print("No of Fifty Notes :",fifty)
print("No of Ten Notes :",ten)
Output:
Enter the Amount to be Withdrawn :23570
No of Hundred Notes : 235
No of Fifty Notes : 1
No of Ten Notes : 2
Result:
Program executed successfully and obtained the required result.
***********
6. Basic Salary Calculation
Aim: Calculating the Basic Salary and Gross salary
Algorithm:
1. Start
2. Accept basic salary.
3. Calculate da as 40% of basic salary, hra as 20% of basic salary.
4. Find the Gross salary.
5. Display the results.
6. Stop
Source Code
basic_salary=int(input("Enter the basic salary:"))
da=0.4*basic_salary
hra=0.2*basic_salary
gross_salary=basic_salary+da+hra
print("Gross Salary = ",gross_salary)
Output
Enter the basic salary:15000
Gross Salary = 24000.0
Result:
Program executed successfully and obtained the required result.
***********
7. Area and circumference of circle
Aim: progam to find area and circumference of circle
Algorithm:
1. Start
2. Accept radius.
3. Calculate area and circumference using the following formula.
𝑨𝒓𝒆𝒂 = 𝝅𝒓𝟐 𝑪𝒊𝒓𝒄𝒖𝒎𝒇𝒆𝒓𝒆𝒏𝒄𝒆 = 𝟐𝝅𝒓
4. Display the output.
5. Stop
Source Code:
radius=int(input("Enter the radious of the circle "))
area=3.14*radius*radius
circumference =2*3.14*radius
print("The area and circumference is ", area, circumference)
OUTPUT
Enter the radius of the circle 6
The area and circumference is 113.03999999999999 37.68
Result:
Program executed successfully and obtained the required result.
***********
8 SIMPLE INTEREST
Aim: Program to find simple interest.
Algorithm:
1. Start
2. Accept Principal amount, rate of interest and duration.
3. Calculate simple interest using PNR/100
4. Display the result.
5. Stop
Source Code:
p=float(input("Enter the principal Amount : "))
r=float(input("Enter the rate of interest : "))
t=float(input("Enter the time period in years : "))
si=p*r*t/100
print("The Interest calculated for the \
amount ",p,"for ",t,"years with\
a rate of interest ",r,"is Rs ",si)
OUTPUT
Enter the principal Amount : 15000
Enter the rate of interest : 8.5
Enter the time period in years : 5
The Interest calculated for the
amount 15000.0 for 5.0 years with
a rate of interest 8.5 is Rs 6375.0
Result:
Program executed successfully and obtained the required result.
***********
9 STUDENT MARKS
Aim: Program to find Student marks and grade
Algorithm:
1. Start
2. Input student’s name, class and section, marks for English, Physics,
Chemistry, Mathematics, Computer Science
3. Calculate total marks: total = eng + phy + che + mat + cs
4. Calculate percentage: Percentage = total / 5
5. Decide grade based on percentage:
If percentage >= 90 → grade = "A"
Else if percentage >= 80 → grade = "B"
Else if percentage >= 70 → grade = "C"
Else if percentage >= 60 → grade = "D"
Else → grade = "Essential repeat!"
6. Display "Mr/Ms. <name>, your total mark is: <total> and your grade is
<grade>"
7. Stop
Source Code
name=input("Enter the student Name : ")
class_sec=input("Enter the class and Section : ")
eng_mk=float(input("Enter the English Mark : "))
phy_mk=float(input("Enter the Physics Mark : "))
che_mk=float(input("Enter the Chemistry Mark : "))
mat_mk=float(input("Enter the Maths Mark : "))
cs_mk=float(input("Enter the Computer science Mark : "))
total=eng_mk + phy_mk + che_mk + mat_mk + cs_mk
percentage=total/5
if percentage >=90:
grade="A"
elif percentage >=80:
grade="B"
elif percentage >=70:
grade="C"
elif percentage >=60:
grade="C"
else:
grade="Essential repeat! "
print("Mr/Ms. ",name,"your total mark is:",total,"and your grade is ",grade)
Output
Enter the student Name : AMITH
Enter the class and Section : XIIA
Enter the English Mark : 98
Enter the PhysicsMark : 96
Enter the Chemistry Mark : 95
Enter the Maths Mark : 97
Enter the Computer science Mark : 96
Mr/Ms. AMITH your total mark is: 482.0 and your grade is A
Result:
Program executed successfully and obtained the required result.
***********
10 Leap year
Aim: Program to check the given year is leap year or not
Algorithm:
1. Start
2. Input a year → year
3. Check leap year condition:
If (year % 400 == 0) OR (year % 4 == 0 AND year % 100 != 0), then:
Display: "Year <year> is a Leap Year"
Else:
Display: "Year <year> is Not a Leap Year"
4. Stop
Source Code:
year=int(input("Enter the year to be checked : "))
if year % 400==0 or year%4==0 and year %100!=0 :
print("Year ",year, "is a Leap Year")
else:
print("Year ",year, "is Not a Leap Year")
Output
Enter the year to be checked : 2024
Year 2024 is a Leap Year
nter the year to be checked : 2025
Year 2025 is Not a Leap Year
Result:
Program executed successfully and obtained the required result.
***********
11. Factorial
Aim: Program to find the factorial of a number.
Algorithm:
1. Start
2. Read the value of n (the number).
3. Set fac ← 1.
4. Repeat steps 5–6 for i from 1 to n (inclusive):
fac ← fac × i
5. End loop.
6. Display "Factorial of n is fac".
7. Stop
Source Code:
n=int(input("Enter any number"))
fac=1
for i in range(1,n+1):
fac=fac*i
print("Factorial of ",n,"is",fac)
Output:
Enter any number4
Factorial of 4 is 24
Result:
Program executed successfully and obtained the required result.
***********
12. Sum of even numbers
Aim: progroam to find the sum of even numbers
Algorithm:
1. Start
2. Read the value of limit.
3. Set sum_eve ← 0.
4. Repeat steps 5–7 for i from 0 to limit - 1:
5. If i % 2 == 0 then:
a. Print i.
b. sum_eve ← sum_eve + i.
5. End loop.
6. Print "The sum of even numbers is sum_eve".
7. Stop
Soruce Code:
sum_eve=0
limit=int(input("enter the limit "))
for i in range(limit):
if i%2==0:
print(i,end=" ")
sum_eve+= i
print("\nThe sum of even numbers is ", sum_eve)
OUTPUT
enter the limit 10
02468
The sum of even numbers is 20
Result:
Program executed successfully and obtained the required result.
***********
13. Area of structures using menu
Aim: Program to find area of Structures
Soruce Code:
while True:
print("1.Area of Circle")
print("2.Area of Rectangle")
print("3.Circumference of Circle")
print("4.Area of Square")
ch=int(input("enter your choice 1 2 3or 4 (Enter 0 to exit)"))
if ch==1:
r=int(input("enter the radious of the circle"))
area=3.14*r*r
print("Area of Circle ",area)
elif ch==2:
l=int(input("enter the length"))
b=int(input("enter the breadth"))
area=l*b
print("Area of Rectangle ",area)
elif ch==3:
r=int(input("enter the radious of the circle"))
=2*3.14*r
print("Circumference of circle ",c)
elif ch==4:
l=int(input("Enter the side of square"))
area=l*l
print("Area of square ",area)
elif ch==0:
break
else:
print("invalid option")
OUTPUT
1.Area of Circle
2.Area of Rectangle
3.Circumference of Circle
4.Area of Square
enter your choice 1 2 3or 4 (Enter 0 to exit)2
enter the length10
enter the breadth20
Area of Rectangle 200
Result:
Program executed successfully and obtained the required result.
***********
14 Fibonocci Series
Aim: program to find Fibonacci Series
Algorithm:
1. Start
2. Initialize variables a and b to -1 and 1, respectively.
3. Loop from 0 to n:
- Print a.
- Update a and b to b and a + b, respectively.
4. Stop
int(input(‘Enter the number of terms’))
f1,f2=-1,1
print(‘Fibonacci Series‘)
for i in range(n):
f3=f1+f2
f1=f2
f2=f3
print(f3,end=’ ‘)
OUTPUT
Enter the number of terms 10
Fibonacci Series
0112358
Result:
Program executed successfully and obtained the required result.
***********
15. Reversing each word in a line of text
Aim: Program to accept a line of text and reverse each word.
Algorithm:
1.Start
2.Input a string str.
3.Split the string into a list of words using split().
4.Initialize an empty string newStr.
5.For each word w in the list of words:
6.Initialize an empty string rw.
7.For each character ch in w:
a. Prepend ch to rw (so the word is reversed).
8. Append rw followed by a space " " to newStr.
9. After processing all words, print newStr.
10. Stop
Source Code:
str = input("Enter a string: ")
words = str.split()
newStr = ""
for w in words :
rw = ""
for ch in w :
rw = ch + rw
newStr += rw + " "
print(newStr)
Output:
Result:
Program executed successfully and obtained the required result.
**********
16. Perfect Number
Aim:
Program to accept a number and check it is a perfect number or not. A perfect
number is a positive integer that equals the sum of its proper divisors (divisors
excluding the number itself). For example, 6 is a perfect number because its
proper divisors are 1, 2, and 3, and 1 + 2 + 3 = 6
Algorithm:
1. Start
2. Input a number n.
3. Initialize sum = 0.
4. For every integer i from 1 to n-1:
5. If n % i == 0 (i divides n), then add i to sum.
6. After the loop, check:
7. If sum == n → Print “Perfect Number”.
8. Else → Print “Not a Perfect Number”.
9. Stop
Source Code:
n = int(input("Enter a number: "))
f=0
for i in range(1, n):
if n % i == 0:
f += i
if f == n:
print(n, "is a Perfect Number")
else:
print(n, "is Not a Perfect Number")
Output:
Enter a number: 28
28 is a Perfect Number
Result:
Program executed successfully and obtained the required result.
***********
17. Armstrong Number:
Aim: Program to check the given number is Armstrong number or not.
An Armstrong number (also called narcissistic number) is a number that is equal to the
sum of its own digits raised to the power of the number of digits.
Examples:
153 → 13+53+33=1531³ + 5³ + 3³ = 15313+53+33=153 ✅ Armstrong
9474 → 94+44+74+44=94749⁴ + 4⁴ + 7⁴ + 4⁴ = 947494+44+74+44=9474 ✅
Armstrong
123 → 13+23+33=361³ + 2³ + 3³ = 3613+23+33=36 ❌ Not Armstrong
Algorithm:
1. Start
2. Input a number n.
3. Find the number of digits d in n.
4. Initialize sum = 0 and temp = n.
5. While temp > 0:
6. Extract the last digit → digit = temp % 10
7. Add digit^d to sum
8. Remove last digit → temp = temp // 10
9. If sum == n, print "n is an Armstrong Number".
Else, print "n is Not an Armstrong Number".
10. Stop
Source Code:
n = int(input("Enter a number: "))
num_digits = len(str(n))
sum_of_powers = 0
temp = n
while temp > 0:
digit = temp % 10
sum_of_powers += digit ** num_digits
temp //= 10
if sum_of_powers == n:
print(n, "is an Armstrong Number")
else:
print(n, "is Not an Armstrong Number")
Output:
Enter a number: 153
153 is an Armstrong Number
Enter a number: 123
123 is Not an Armstrong Number
Result:
Program executed successfully and obtained the required result.
***********
18. Menu Driven – Dictionary
Aim: A menu driven program using dictionary to manipulate employee
information
Source Code:
d={ }
data=[ ]
n=int(input("Enter the number of employees:- "))
for i in range(n):
name=input("enter the Name :- ")
salary=float(input("enter the salary : - "))
allowance=float(input("enter the allowance : - "))
deduction=float(input("enter the deduction : - "))
d[name]=[salary,allowance,deduction]
ch=0
while True:
print("1 . Display the total salary ")
print("2 . Display the total allowance and deduction ")
print("3. search for an employee ")
print("4 . Exit ")
ch=int(input("Enter your choice "))
if ch==1:
for key,value in d.items():
gross=value[0]+value[1]
net=gross-value[2]
print("NAME - ",key,"Gross - ",gross,"NET - ",net)
elif ch==2:
total_allowance=0
total_deduction=0
for key,value in d.items():
total_allowance+=value[1]
total_deduction+=value[2]
print("Total allowance : ",total_allowance)
print("Total deduction : ",total_deduction)
elif ch==3:
n=input("Enter the employee name to be searched :- ")
for key,value in d.items():
if key==n:
print(key,value[0],value[1],value[2])
break
else:
print("Not Found..!")
elif ch==4:
break
else:
print("wrong Choice ")
OUT PUT
Enter the number of employees:- 2
enter the Name :- vinay
enter the salary : - 25689
enter the allowance : - 2500
enter the adeduction : - 1500
enter the Name :- sinu
enter the salary : - 89653
enter the allowance : - 4582
enter the adeduction : - 3000
1 . Display the total salary
2 . Display the total allowance and deduction
3. search for an employee
4 . Exit
Enter your choice 1
NAME - vinay Gross - 28189.0 NET - 26689.0
NAME - sinu Gross - 94235.0 NET - 91235.0
Result:
Program executed successfully and obtained the required result.
***********
19. Sum of the elements in a list
Aim: Program to find the sum of the elements in list
Source Code:
l1=[]
listsum=0
limit=int(input("Enter the limit "))
for i in range(limit):
num=int(input("Enter the number to be appended to the list "))
l1.append(num)
print("the original list is :",l1)
for i in range(limit):
listsum+=l1[i]
print("the sum of elements in the list ",l1 ,"is :",listsum)
OUTPUT
Enter the limit 4
Enter the number to be appended to the list 10
Enter the number to be appended to the list 20
Enter the number to be appended to the list 5
Enter the number to be appended to the list 9
the original list is : [10, 20, 5, 9]
the sum of elements in the list [10, 20, 5, 9] is : 44
Result:
Program executed successfully and obtained the required result.
***********
20 List Updation
Aim: program to replace all positive numbers by 1 and negative numbers by -1
in a list
Source Code:
l1=[]
limit=int(input("Enter the limit "))
for i in range(limit):
num=int(input("Enter the number tobe appended to the list "))
l1.append(num)
print("the original list is :",l1)
for i in range(limit):
if l1[i]>0:
l1[i]=1
elif l1[i]<0:
l1[i]=-1
else:
l1[i]=l1[i]
print("the list after updation is :",l1)
OUTPUT
Enter the limit 4
Enter the number tobe appended to the list 5
Enter the number tobe appended to the list -4
Enter the number tobe appended to the list 0
Enter the number tobe appended to the list 9
the original list is : [5, -4, 0, 9]
the list after updation is : [1, -1, 0, 1]
Result:
Program executed successfully and obtained the required result.
***********
21 Prime number
Aim: Program to check the given number is prime number or not
prime number is a natural number greater than 1 that has only two factors: 1 and itself.
Examples: 2, 3, 5, 7, 11…
Algorithm:
1. Start
2. Input a number n.
3. If n <= 1, then it is not prime.
4. Initialize a flag variable isPrime = True.
5. For each integer i from 2 to n-1:
6. If n % i == 0, then set isPrime = False and stop checking.
7. If isPrime == True, print "n is a Prime Number".
Else, print "n is Not a Prime Number".
8. Stop
Source Code:
n = int(input("Enter a number: "))
if n <= 1:
print(n, "is Not a Prime Number")
else:
isPrime = True
for i in range(2, n):
if n % i == 0:
isPrime = False
break
if isPrime:
print(n, "is a Prime Number")
else:
print(n, "is Not a Prime Number")
Output:
Enter a number: 29
29 is a Prime Number
Result:
Program executed successfully and obtained the required result.
***********
22 Palindrome number
Aim: Program to check the given number is palindrome or not.
Algorithm:
1. Start
2. Input the number org.
3. Assign num = org.
4. Initialize rev = 0.
5. Repeat while num > 0:
a. Extract the last digit → digit = num % 10.
b. Append digit to reversed number → rev = rev * 10 + digit.
c. Remove the last digit from num → num = num // 10.
6. After loop ends, compare org with rev.
7. If org == rev, then the number is a Palindrome.
8. Else, the number is Not a Palindrome.
9. Stop.
Source Code:
org=int(input("Enter the number "))
num=org
rev=0
digit=0
while num>0:
digit=num%10
rev=rev*10+digit
num=num//10
if org==rev:
print(org,"its Palindrome ")
else:
print(org,"its Not Palindrome ")
OUTPUT
Enter the number 121
121 its Palindrome
Enter the number 456
456 its Not Palindrome
Result:
Program executed successfully and obtained the required result.
***********
23 Palindrome String
Aim: Program to check the given string is palindrome or not
Algorithm:
1. Start
2. Input a string and store it in string1.
3. Display "original string is", string1.
4. Reverse the string using slicing → string2 = string1[::-1].
5. Display "reversed string is", string2.
6. Compare string1 with string2:
7. If string1 == string2, then print "Palindrome String".
8. Else, print "Not a Palindrome String".
9. Stop
Source Code:
string1=input("Enter the string ")
print("original string is ",string1)
string2=string1[::-1]
print("reversed string is ",string2)
if string2==string1:
print(string2,"its a palindrome string")
else:
print(string2,"its NOT a palindrome string")
OUTPUT
Enter the string KENDRIYA VIDYALAYA
original string is KENDRIYA VIDYALAYA
reversed string is AYALAYDIV AYIRDNEK
AYALAYDIV AYIRDNEK its NOT a palindrome string
Enter the string malayalam
original string is malayalam
reversed string is malayalam
malayalam its a palindrome string
Result:
Program executed successfully and obtained the required result.
***********
24 String character conversion
Aim: Program to change upper case to lower case and lower to upper case
characters in String
Algorithm:
1. Start
2. Input a string and store it in str1.
3. Initialize an empty string str2 = "".
4. Find the length of the string → l1 = len(str1).
5. Repeat for each character in str1 (from index 0 to l1-1):
a. If the character is uppercase, convert it to lowercase and append to
str2.
b. Else if the character is lowercase, convert it to uppercase and append
to str2.
c. Else (for digits, spaces, or special characters), append it unchanged to
str2.
6. After the loop ends, display:
7. "The original String:", str1
8. "The String after conversion:", str2
9. Stop.
Source Code:
str1=input("Enter a String ")
str2=""
l1=len(str1)
for i in range(l1):
if str1[i].isupper():
str2=str2+str1[i].lower()
elif str1[i].islower():
str2=str2+str1[i].upper()
else:
str2=str2+str1[i]
print("The original String", str1)
print("The String after conversion", str2)
OUTPUT
Enter a String KendriYA VidYAlaya
The original String KendriYA VidYAlaya
The String after conversion kENDRIya vIDyaLAYA
Result:
Program executed successfully and obtained the required result.
***********
25 Character Count in String
Aim: Program to count Upper,Lower,Digts & Special character in String
Algorithm:
1. Start
2. Input a string and store it in str1.
3. Find the length of the string → l1 = len(str1).
4. Initialize counters:
5. st_caps = 0 (uppercase count)
6. st_small = 0 (lowercase count)
7. st_digit = 0 (digit count)
8. st_spchar = 0 (special character count)
9. Repeat for each character in the string (i = 0 to l1 - 1):
a. If the character is uppercase, increment st_caps.
b. Else if the character is lowercase, increment st_small.
c. Else if the character is a digit, increment st_digit.
d. Else, increment st_spchar.
10. After the loop ends, display:
"Upper case characters:", st_caps
"Lower case characters:", st_small
"Digits:", st_digit
"Other characters:", st_spchar
11. Stop.
Source Code:
str1=input("Enter a String ")
l1=len(str1)
st_caps=0
st_small=0
st_digit=0
st_spchar=0
for i in range(l1):
if str1[i].isupper():
st_caps+=1
elif str1[i].islower():
st_small+=1
elif str1[i].isdigit():
st_digit+=1
else:
st_spchar+=1
print("Upper case characters", st_caps)
print("lower case characters", st_small)
print("digits", st_digit)
print("Other characters ", st_spchar)
OUTPUT
Enter a String K V Pattom @ TrivandruM1
Upper case characters 5
lower case characters 13
digits 1
Other characters 5
Result:
Program executed successfully and obtained the required result.
***********