PRACTICAL FILE
COMPUTER SCIENCE
(Code: 083)
Class XI
<b>Name:</b> ________________________________________
<b>Class:</b> XI - Section ______
<b>Roll Number:</b> ________________________________________
<b>School:</b> ________________________________________
<b>Session:</b> 2025-2026
CERTIFICATE
This is to certify that this practical file has been completed by the above student during the academic
year 2025-2026 as per CBSE guidelines for Computer Science (Code: 083), Class XI.
_____________________ _____________________
Teacher's Signature Principal's Signature
Date: ___________ School Seal
INDEX
<b>Sr. No.</b> <b>Program Title</b> <b>Page</b>
1 Print User Name - Input/Output 3
2 Add Two Numbers 3
3 Area of Circle 4
4 Temperature Converter (C to F) 4
5 Simple Interest Calculator 5
6 Check Even or Odd Number 5
7 Greatest of Three Numbers 6
8 Check Positive/Negative/Zero 6
9 Vowel or Consonant Checker 7
10 Grade Calculator Based on Marks 7
11 Print Numbers 1 to N 8
12 Sum of N Natural Numbers 8
13 Factorial of a Number 9
14 Multiplication Table 9
15 Fibonacci Series 10
16 Count Vowels in String 10
17 Reverse a String 11
18 Palindrome String Checker 11
19 Count Words in Sentence 12
20 Sum of List Elements 12
21 Largest Element in List 13
22 Sort a List 13
23 Search Element in List 14
24 Prime Number Checker (Function) 14
25 Square and Cube Calculator (Function) 15
26 Reverse a Number (Function) 15
27 Star Pattern - Right Triangle 16
28 Number Pattern - Pyramid 16
Program 1
Print User Name - Input/Output
Aim:
Write a Python program to accept user's name and display a personalized greeting message.
Source Code:
# Program to take user's name and print a greeting
name = input("Enter your name: ")
print("Hello,", name, "!")
print("Welcome to Python Programming")
Output:
Enter your name: Priya
Hello, Priya !
Welcome to Python Programming
Date: ____________ Teacher's Sign: ____________
Program 2
Add Two Numbers
Aim:
Write a Python program to add two numbers entered by the user and display the result.
Source Code:
# Program to add two numbers
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
sum = num1 + num2
print("The sum is:", sum)
Output:
Enter first number: 25
Enter second number: 35
The sum is: 60
Date: ____________ Teacher's Sign: ____________
Program 3
Area of Circle
Aim:
Write a Python program to calculate and display the area of a circle when radius is given.
Source Code:
# Program to calculate area of a circle
import math
radius = float(input("Enter radius of circle: "))
area = [Link] * radius * radius
print("Area of circle:", round(area, 2))
Output:
Enter radius of circle: 7
Area of circle: 153.94
Date: ____________ Teacher's Sign: ____________
Program 4
Temperature Converter (Celsius to Fahrenheit)
Aim:
Write a Python program to convert temperature from Celsius to Fahrenheit.
Source Code:
# Program to convert Celsius to Fahrenheit
celsius = float(input("Enter temperature in Celsius: "))
fahrenheit = (celsius * 9/5) + 32
print(f"{celsius}°C = {fahrenheit}°F")
Output:
Enter temperature in Celsius: 37
37.0°C = 98.6°F
Date: ____________ Teacher's Sign: ____________
Program 5
Simple Interest Calculator
Aim:
Write a Python program to calculate Simple Interest using the formula SI = (P × R × T) / 100.
Source Code:
# Program to calculate Simple Interest
principal = float(input("Enter principal amount: "))
rate = float(input("Enter rate of interest: "))
time = float(input("Enter time period (years): "))
simple_interest = (principal * rate * time) / 100
print("Simple Interest:", simple_interest)
Output:
Enter principal amount: 10000
Enter rate of interest: 5
Enter time period (years): 2
Simple Interest: 1000.0
Date: ____________ Teacher's Sign: ____________
Program 6
Check Even or Odd Number
Aim:
Write a Python program to check whether a given number is even or odd using if-else statement.
Source Code:
# Program to check if a number is even or odd
num = int(input("Enter a number: "))
if num % 2 == 0:
print(num, "is Even")
else:
print(num, "is Odd")
Output:
Enter a number: 18
18 is Even
Date: ____________ Teacher's Sign: ____________
Program 7
Greatest of Three Numbers
Aim:
Write a Python program to find and display the greatest among three numbers using conditional
statements.
Source Code:
# Program to find the greatest of three numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
if a >= b and a >= c:
print(a, "is the greatest")
elif b >= a and b >= c:
print(b, "is the greatest")
else:
print(c, "is the greatest")
Output:
Enter first number: 45
Enter second number: 67
Enter third number: 23
67 is the greatest
Date: ____________ Teacher's Sign: ____________
Program 8
Check Positive, Negative or Zero
Aim:
Write a Python program to check whether a given number is positive, negative or zero.
Source Code:
# Program to check if number is positive, negative or zero
num = float(input("Enter a number: "))
if num > 0:
print("Positive number")
elif num < 0:
print("Negative number")
else:
print("Zero")
Output:
Enter a number: -12.5
Negative number
Date: ____________ Teacher's Sign: ____________
Program 9
Vowel or Consonant Checker
Aim:
Write a Python program to check whether an input alphabet is a vowel or consonant.
Source Code:
# Program to check if a letter is vowel or consonant
letter = input("Enter a letter: ").lower()
if letter in 'aeiou':
print(letter, "is a Vowel")
elif [Link]() and len(letter) == 1:
print(letter, "is a Consonant")
else:
print("Invalid input")
Output:
Enter a letter: a
a is a Vowel
Date: ____________ Teacher's Sign: ____________
Program 10
Grade Calculator Based on Marks
Aim:
Write a Python program to assign grades based on marks obtained by a student.
Source Code:
# Program to calculate grade based on marks
marks = int(input("Enter marks (0-100): "))
if marks >= 90:
grade = 'A+'
elif marks >= 80:
grade = 'A'
elif marks >= 70:
grade = 'B'
elif marks >= 60:
grade = 'C'
elif marks >= 50:
grade = 'D'
else:
grade = 'F'
print("Grade:", grade)
Output:
Enter marks (0-100): 88
Grade: A
Date: ____________ Teacher's Sign: ____________
Program 11
Print Numbers 1 to N
Aim:
Write a Python program to print all numbers from 1 to N using a for loop.
Source Code:
# Program to print numbers from 1 to N
n = int(input("Enter a number: "))
for i in range(1, n+1):
print(i, end=" ")
print()
Output:
Enter a number: 10
1 2 3 4 5 6 7 8 9 10
Date: ____________ Teacher's Sign: ____________
Program 12
Sum of N Natural Numbers
Aim:
Write a Python program to calculate the sum of first N natural numbers using a loop.
Source Code:
# Program to find sum of first N natural numbers
n = int(input("Enter a number: "))
sum = 0
for i in range(1, n+1):
sum += i
print("Sum of first", n, "natural numbers:", sum)
Output:
Enter a number: 10
Sum of first 10 natural numbers: 55
Date: ____________ Teacher's Sign: ____________
Program 13
Factorial of a Number
Aim:
Write a Python program to find the factorial of a given number using a loop.
Source Code:
# Program to find factorial of a number
num = int(input("Enter a number: "))
factorial = 1
for i in range(1, num+1):
factorial *= i
print("Factorial of", num, "is", factorial)
Output:
Enter a number: 6
Factorial of 6 is 720
Date: ____________ Teacher's Sign: ____________
Program 14
Multiplication Table
Aim:
Write a Python program to print the multiplication table of any given number.
Source Code:
# Program to print multiplication table
num = int(input("Enter a number: "))
print(f"Multiplication table of {num}:")
for i in range(1, 11):
print(f"{num} x {i} = {num*i}")
Output:
Enter a number: 8
Multiplication table of 8:
8 x 1 = 8
8 x 2 = 16
8 x 3 = 24
...continues till...
8 x 10 = 80
Date: ____________ Teacher's Sign: ____________
Program 15
Fibonacci Series
Aim:
Write a Python program to print Fibonacci series up to N terms.
Source Code:
# Program to print Fibonacci series up to N terms
n = int(input("Enter number of terms: "))
a, b = 0, 1
print("Fibonacci Series:")
for i in range(n):
print(a, end=" ")
a, b = b, a + b
print()
Output:
Enter number of terms: 10
Fibonacci Series:
0 1 1 2 3 5 8 13 21 34
Date: ____________ Teacher's Sign: ____________
Program 16
Count Vowels in String
Aim:
Write a Python program to count the total number of vowels in a given string.
Source Code:
# Program to count vowels in a string
string = input("Enter a string: ")
vowels = 'aeiouAEIOU'
count = 0
for char in string:
if char in vowels:
count += 1
print("Number of vowels:", count)
Output:
Enter a string: Education
Number of vowels: 5
Date: ____________ Teacher's Sign: ____________
Program 17
Reverse a String
Aim:
Write a Python program to reverse a given string using string slicing.
Source Code:
# Program to reverse a string
string = input("Enter a string: ")
reversed_string = string[::-1]
print("Reversed string:", reversed_string)
Output:
Enter a string: Computer
Reversed string: retupmoC
Date: ____________ Teacher's Sign: ____________
Program 18
Palindrome String Checker
Aim:
Write a Python program to check whether a given string is a palindrome or not.
Source Code:
# Program to check if a string is palindrome
string = input("Enter a string: ").lower()
if string == string[::-1]:
print(string, "is a Palindrome")
else:
print(string, "is not a Palindrome")
Output:
Enter a string: madam
madam is a Palindrome
Date: ____________ Teacher's Sign: ____________
Program 19
Count Words in Sentence
Aim:
Write a Python program to count the total number of words in a given sentence.
Source Code:
# Program to count words in a string
sentence = input("Enter a sentence: ")
words = [Link]()
print("Number of words:", len(words))
Output:
Enter a sentence: Python is fun to learn
Number of words: 5
Date: ____________ Teacher's Sign: ____________
Program 20
Sum of List Elements
Aim:
Write a Python program to find the sum of all elements present in a list.
Source Code:
# Program to find sum of all elements in a list
numbers = []
n = int(input("How many numbers? "))
for i in range(n):
num = int(input(f"Enter number {i+1}: "))
[Link](num)
print("Sum of list elements:", sum(numbers))
Output:
How many numbers? 4
Enter number 1: 10
Enter number 2: 20
Enter number 3: 30
Enter number 4: 40
Sum of list elements: 100
Date: ____________ Teacher's Sign: ____________
Program 21
Largest Element in List
Aim:
Write a Python program to find the largest element in a list using both built-in and manual methods.
Source Code:
# Program to find largest element in a list
numbers = [45, 23, 78, 12, 89, 34]
print("List:", numbers)
print("Largest element:", max(numbers))
# Alternative without using max()
largest = numbers[0]
for num in numbers:
if num > largest:
largest = num
print("Largest (manual method):", largest)
Output:
List: [45, 23, 78, 12, 89, 34]
Largest element: 89
Largest (manual method): 89
Date: ____________ Teacher's Sign: ____________
Program 22
Sort a List
Aim:
Write a Python program to sort a list in both ascending and descending order.
Source Code:
# Program to sort a list
numbers = [64, 34, 25, 12, 22, 11, 90]
print("Original list:", numbers)
[Link]()
print("Sorted (ascending):", numbers)
[Link](reverse=True)
print("Sorted (descending):", numbers)
Output:
Original list: [64, 34, 25, 12, 22, 11, 90]
Sorted (ascending): [11, 12, 22, 25, 34, 64, 90]
Sorted (descending): [90, 64, 34, 25, 22, 12, 11]
Date: ____________ Teacher's Sign: ____________
Program 23
Search Element in List
Aim:
Write a Python program to search for a specific element in a list and display its position.
Source Code:
# Program to search an element in a list
numbers = [10, 20, 30, 40, 50]
print("List:", numbers)
search = int(input("Enter number to search: "))
if search in numbers:
print(f"{search} found at index {[Link](search)}")
else:
print(f"{search} not found in list")
Output:
List: [10, 20, 30, 40, 50]
Enter number to search: 30
30 found at index 2
Date: ____________ Teacher's Sign: ____________
Program 24
Prime Number Checker (Function)
Aim:
Write a Python program using a function to check whether a given number is prime or not.
Source Code:
# Program to check if a number is prime using function
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
num = int(input("Enter a number: "))
if is_prime(num):
print(f"{num} is a Prime number")
else:
print(f"{num} is not a Prime number")
Output:
Enter a number: 29
29 is a Prime number
Date: ____________ Teacher's Sign: ____________
Program 25
Square and Cube Calculator (Function)
Aim:
Write a Python program with a function to calculate and return both square and cube of a number.
Source Code:
# Program with function to find square and cube
def calculate(num):
square = num ** 2
cube = num ** 3
return square, cube
number = int(input("Enter a number: "))
sq, cb = calculate(number)
print(f"Square of {number}: {sq}")
print(f"Cube of {number}: {cb}")
Output:
Enter a number: 4
Square of 4: 16
Cube of 4: 64
Date: ____________ Teacher's Sign: ____________
Program 26
Reverse a Number (Function)
Aim:
Write a Python program using a function to reverse the digits of a given number.
Source Code:
# Program to reverse a number using function
def reverse_number(num):
reversed_num = 0
while num > 0:
digit = num % 10
reversed_num = reversed_num * 10 + digit
num = num // 10
return reversed_num
number = int(input("Enter a number: "))
print("Reversed number:", reverse_number(number))
Output:
Enter a number: 56789
Reversed number: 98765
Date: ____________ Teacher's Sign: ____________
Program 27
Star Pattern - Right Triangle
Aim:
Write a Python program to print a right-angled triangle pattern using stars (*) with nested loops.
Source Code:
# Program to print star pattern
n = int(input("Enter number of rows: "))
for i in range(1, n+1):
for j in range(i):
print("*", end=" ")
print()
Output:
Enter number of rows: 5
*
* *
* * *
* * * *
* * * * *
Date: ____________ Teacher's Sign: ____________
Program 28
Number Pattern - Pyramid
Aim:
Write a Python program to print a pyramid pattern using numbers with proper spacing.
Source Code:
# Program to print number pattern
n = int(input("Enter number of rows: "))
for i in range(1, n+1):
# Print spaces
for j in range(n-i):
print(" ", end=" ")
# Print numbers
for j in range(1, i+1):
print(j, end=" ")
print()
Output:
Enter number of rows: 5
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Date: ____________ Teacher's Sign: ____________