0% found this document useful (0 votes)
23 views27 pages

Lab Manual Grade XI

Uploaded by

durgasiva2410
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views27 pages

Lab Manual Grade XI

Uploaded by

durgasiva2410
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

DR.G.S.

KALYANASUNDARAM MEMORIAL SCHOOL


PATTESWARAM ROAD, CHOZHAN MALIGAI

LIST OF PRACTICAL (2023-2024)


SUBJECT: COMPUTER SCIENCE
SUBJECT CODE: 083
GRADE:XI
Index
Page
Sno Content
No

1 Write a Python script to print Bio data using input function.

2 Write a Python script to calculate the simple interest.

3 Write a Python Script to display a Student’s Mark list.


Write a Python Script to perform arithmetic operations based on user’s
4
choice.

5 Write a Python Script to find the factorial of a given number

6 Writea Python Script to print the Fibonacciseries up to nth term

Write a Python script to find the largest number amongst 3 given


7
numbers
Write a Python Script to print the given Pattern.
*
**
8
***
****
*****
Write a Python script to check whether the given number is Armstrong
9
number or not.
Write a Python Script to print the number of letters and digits from the
10
given string.
11 Write a Python script to remove the vowels from the string.

12 Write a Python Script to remove duplicates from a list.


Write a Python script to shift all the odd numbers to the left and even
13
numbers to the right in a given list of numbers.
Write a Python script to create a list of tuples with the first element
14
as the number and second element as the square of the number
15 Write a Python Script to find the sum ofall values in a dictionary.
Practical File
Ex. No. : 1 BIO DATA

Aim:

To Write a Python Script to print Bio data using input function

Source Code:
print("\t\t\t\t BIO DATA")
name=input("Enter your Name : ")
age=int(input("Enter age : "))
dob=input("Enter Date of Birth : ")
bg=input("Enter Blood Group : ")
fname=input("Enter Father's Name : ")
mname=input("Enter Mother's Name : ")
addr=input("Enter Address : ")
ph=input("Enter Phone Number : ")
print("Name : ",name)
print("Age : ",age)
print("DOB : ",dob)
print("Blood Group : ",bg)
print("Father's Name : ",fname)
print("Mother's Name : ",mname)
print("Address : ",addr)
print("Phone Number : ",ph)
Output:
BIO DATA
Enter your Name : Ram
Enter age : 25

Enter Date of Birth : 04.05.1995


Enter Blood Group : O+ve
Enter Father's Name : Mukesh
Enter Mother's Name : Malini
Enter Address : 10, Fifth Street, Kumbakonam
Enter Phone Number : 9876543210
Name : Ram
Age : 25
DOB : 04.05.1995
Blood Group : O+ve
Father's Name : Mukesh
Mother's Name : Malini
Address : 10, Fifth Street, Kumbakonam
Phone Number : 9876543210

Result:
Thus the program has been executed successfully
Ex. No. : 2 SIMPLE INTEREST

Aim:
To Write a Python Script to calculate the value of simple
interest.

Source Code:
p=eval(input("Enter Principle Amount : "))
n=eval(input("Enter No. of Years : "))
r=eval(input("Enter Rate of Interest : "))
simp_Int=(p*n*r)/100
print("Simple Interest = ",simp_Int)

Output:

Enter Principle Amount : 15000


Enter No. of Years : 3
Enter Rate of Interest : 1.5

Simple Interest = 675.0

Result:
Thus the program has been executed successfully .
Ex. No. : 3 STUDENT MARKLIST

Aim:

To Write a Python Script to display a Student’s Mark list.

Source Code:

name=input("Enter Student Name : ")


clas=input("Enter Class & Section : ")
m1=eval(input("Enter Mark 1 : "))
m2=eval(input("Enter Mark 2 : "))
m3=eval(input("Enter Mark 3 : "))
m4=eval(input("Enter Mark 4 : "))
m5=eval(input("Enter Mark 5 : "))
total=m1+m2+m3+m4+m5
avg=total/5

print("Name = ",name)
print("Class & Section = ",clas)
print("Total = ",total)
print("Average = ",avg)
Output:

Enter Student Name : Hariharan


Enter Class & Section : 11 A
Enter Mark 1 : 64
Enter Mark 2 : 76

Enter Mark 3 : 83
Enter Mark 4 : 72
Enter Mark 5 : 86
Name = Hariharan
Class & Section = 11 A
Total = 381
Average = 76.2

Result:
Thus the program has been executed successfully .
Ex. No. : 4 Arithmetic Operations

Aim :
To Write a Python Script to perform arithmetic operations
based on user’s choice.

Source Code:
a=int(input("Enter Number 1 : "))
b=int(input("Enter Number 2 : "))
print("1.Addition")
print("2.Subtraction")
print("3.Multiplication")
print("4.Division")
ch=int(input("Enter your Choice : "))
if ch==1:
print("Sum = ",a+b)
elif ch==2:
print("Difference = ",a-b)
elif ch==3:
print("Product = ",a*b)
elif ch==4:
print("Quotient = ",a/b)
else:
print("Invalid Choice")
Output:
Enter Number 1 : 5
Enter Number 2 : 3
1.Addition
2.Subtraction
3.Multiplication
4.Division
Enter your Choice : 3
Product = 15

Result:
Thus the program has been executed successfully .
Ex. No. : 5 Factorial of a given Number

Aim:
To Write a Python Script to find the factorial of a given number

Source Code:

f=1
n=int(input("Enter an Integer : "))
for i in range(1,n+1):
f=f*i
print("Factorial of Given Value = ",f)

Output:

Enter an Integer : 5
Factorial of Given Value = 120

Result:
Thus the program has been executed successfully.
Ex. No. : 6 Fibonacci Series

Aim:
To Write a Python Script to print the Fibonacci series upto nth
term

Source Code:
n=int(input("Enter N value : "))
a=-1
b=1
print("\t Fibonacci Series")
for x in range(1,n+1):
c=a+b
print(c)
a=b
b=c
Output:
Enter N value : 8
Fibonacci Series
0
1
1
2
3
5
8
13

Result:
Thus the program has been executed successfully and the output is
verified
Ex. No. : 7 Largest of 3 Numbers

Aim:
To Write a Python Script to find the largest number amongst 3
given numbers

Source Code:
a=int(input("Enter Number 1 :"))
b=int(input("Enter Number 2 :"))
c=int(input("Enter Number 3 : "))
if a>b and a>c:
print("Biggest Number = ",a)
elif b>c:
print("Biggest Number = ",b)
else:
print("Biggest Number = ",c)
Output:
Enter Number 1 : 5
Enter Number 2 : 23
Enter Number 3 : 54
Biggest Number = 54

Result:
Thus the program has been executed successfully and the
output is verified.
Ex. No. : 8 Pattern Display

Aim:

To Write a Python Script to print the pattern

Source Code:
for i in range(5):

for j in range(5):

if j<=i:

print("*",end=" ")

print()
Output:

*
**
***
****
*****

Result:
Thus the program has been executed successfully and the
output is verified.
Ex. No. : 9 ARMSTRONG NUMBER

Aim:
To Write a Python Script to check whether the given number is
palindrome or not.

Source Code:
n=int(input("Enter a Number : "))
a=n
b=0
while a>0:
r=a%10
b=b+(r**3)
a=a//10
if n==b:
print("Given Number is Armstrong No. ")
else:
print("Given Number is Not an Armstrong No.")
Output:
Enter a Number : 143

Given Number is Not an Armstrong No.

Enter a Number : 153

Given Number is Armstrong No.

Result:
Thus the program has been executed successfully and the
output is verified.
Ex.No. 10 Counting No. of letters & Digits

Aim:
To Write a Python Script to print the number of Alphabets
and digits from the given string.

Source Code:
s1=input("Enter a String : ")
digit=0
words=0
letters=0
z=s1.split()
words=len(z)
for x in s1:
if x.isalpha():
letters+=1
elif x.isdigit():
digit+=1
print("No. of Letters : ",letters )
print("No. of Digits : ",digit )
Output:
Enter a String : This is example number 256
No. of Alphabets : 19
No. of Digits : 3

Result:
Thus the program has been executed successfully and the
output is verified.
Ex. No. : 11 Removing Vowels from a string

Aim:
To Write a Python Script to remove the vowels from a string.

Source Code:
s1=input("Enter a String : ")
s2=" "
for x in s1:
if x not in "aeiouAEIOU":
s2=s2+x
print("Given String : ",s1)
print("After removing Vowel : ", s2)

Output:

Enter a String : Example


Given String : Example
After removing Vowel : xmpl

Result:
Thus the program has been executed successfully and the
output is verified.
Ex. No. : 12 Removing Duplicates from a List

Aim:
To Write a Python Script to remove the duplicate elements
from a list.

Source Code:

list1=eval(input("Enter List Elements : "))


for x in list1:
if list1.count(x)>1:
list1.remove(x)
print("After Removing duplicates : ",list1)

Output:

Enter List Elements : [1,2,1,"hello","abc","hello",3,2]


After Removing duplicates : [1, 'abc', 'hello', 3, 2]

Result:
Thus the program has been executed successfully and the
output is verified.
Ex. No. : 13 Shifting Odd Numbers to left and even to right

Aim:
To Write a Python Script to shift all the odd numbers to the left
and even numbers to the right in a given list of numbers.

Source Code:
list1=eval(input("Enter a Numbered List : "))
odd=[]
even=[]
for x in list1:
if x%2==0:
even+=[x]
else:
odd+=[x]
print("Resultant List : ",odd+even)

Output:
Enter a Numbered List : [1,2,3,4,5]
Resultant List : [1, 3, 5, 2, 4]

Result:
Thus the program has been executed successfully and the
output is verified.
Ex. No. : 14 Number and its Square – List of Tuples

Aim:
To Write a Python Script to Create List of Tuples with the First
Element as the Number and Second Element as the Square of the
Number.

Source Code:
n=eval(input("Enter Number of Elements for the list : "))
l1=[]
for x in range(1,n+1):
f=int(input(“Enter the value”))
t1=(f, f*f)
l1=l1+ [t1]
print("Required List of Tuples : ",l1)
Output:

Enter Number of Elements for the list: 4


Enter the value2
Enter the value3
Enter the value4
Enter the value5
Required List of Tuples: [(2, 4), (3, 9), (4, 16), (5, 25)]

Result:
Thus the program has been executed successfully and the
output is verified.
Ex. No. : 15 Sum of the Values of Dictionary

Aim:
To Write a Python Script to find the sum of all values
in a dictionary

Source Code:
d1=eval(input("Enter Dictionary Elements : "))
s=0
for x in d1.values():
s+=x
print("Sum of the Values of Dictionary : ",s)
Output:

Enter Dictionary Elements : {1:10,2:20,3:30}


Sum of the Values of Dictionary : 60

Result:
Thus the program has been executed successfully and the
output is verified.

You might also like