Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
45 views23 pages

CS Practical File Pranav OG

This document is a Computer Science Practical File submitted by Pranav Singhal for the academic session 2025-26 at Presidency International School, Bhiwadi. It includes a certificate of completion, acknowledgments, and an index of Python programs and MySQL commands with source code and outputs. The practical work aims to fulfill the requirements set by the Central Board of Secondary Education (CBSE).

Uploaded by

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

CS Practical File Pranav OG

This document is a Computer Science Practical File submitted by Pranav Singhal for the academic session 2025-26 at Presidency International School, Bhiwadi. It includes a certificate of completion, acknowledgments, and an index of Python programs and MySQL commands with source code and outputs. The practical work aims to fulfill the requirements set by the Central Board of Secondary Education (CBSE).

Uploaded by

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

PRESIDENCY THE INTERNATIONAL SCHOOL

BHIWADI, KHAIRTHAL TIZARA, RAJASTHAN

COMPUTER SCIENCE (083)


PRACTICAL FILE
(PYTHON PROGRAMS & MYSQL)
ACADEMIC SESSION: 2025-26

SUBMITTED TO: SUBMITTED BY:

MS. NEETU PATEL NAME – Pranav Singhal

(PGT Computer Science) CLASS - XII C

ROLL NO - 12320
CERTIFICATE

This is to certify that Computer Science Practical File


has been successfully completed by Pranav Singhal,
student of Class XII C, in partial fulfilment of the
requirements for Computer Science practical
examination, as prescribed by Central Board of
Secondary Education (CBSE) for the academic year
2025 – 26.

The practical work has been carried out under my


supervision and is the original work of the student.

Principal :

Ms. Shalini Malhotra

Date :

Internal Examiner: External Examiner :

Ms. Neetu Patel Name:

(PGT Computer Science) Designation :

Sign : Sign :
ACKNOWLEDGEMENT

I would like to express my sincere gratitude to all those who


have contributed to the successful completion of this
Computer Science Practical File.

I am grateful to my Computer Science teacher, Ms. Neetu


Patel, for her constant guidance, encouragement, and
valuable insights throughout the course of the practicals.
Her support played a crucial role in shaping the outcome of
my work.

I would also like to extend my thanks to our respected


Principal, Ms. Shalini Malhotra and the school
management for encouraging students to apply theoretical
knowledge in practical settings by providing the necessary
facilities and a conducive environment for learning and
exploration.

It was truly a privileged experience to work under the


guidance of extremely supportive school staff members
who proactively addressed all queries related to practical
guidelines. This practical work has been a valuable learning
experience and has deepened my understanding of the
subject

PRANAV SINGHAL

Class - XII C
Index

S.NO Python Programs Sign

Write definition of a method COUNTNOW(REGIONS) to find and display names


1. of those REGIONS, in which there are less than or equal to 5 characters.

Write the definition of a method/function SearchOut(Teachers, TName) to


2. search for TName from a list Teachers, and display the position of its presence.

Write a function countNow(PLACES) in Python, that takes the dictionary,

3. PLACES as an argument and displays the names(in uppercase) of the places


whose names are longer than 5 characters.

Python program to read a file containing email addresses separated by spaces

4. and display those email addresses ,belong to Gmail domain

Write a Python program to read words from a file and print only those words

5. whose length is greater than 5.

Write a Python program to read lines from a file and print only the lines
6. containing the '@' symbol

7. Write a Python program to check runs conceded in each over from a list. Print
"Maiden Over" if the runs are 0, otherwise print "Not Maiden".

Write a Python program that takes a word as input and prints "Ok" if the

8. word is "Hello", otherwise prints "Not Ok".

Print a pattern of dollar signs for even numbers from 2 to 6, repeating the

9. dollar sign according to each number.


Given the string a = "Year 2022 at All the best", split it by the character '2'

10.

/7Index

S.NO MYSQL SIGN


CREATING A DATABASE
1.
SHOWING DATABASES
2.
USING A DATABASE
3.
CREATING TABLES WITH
4. CONSTRAINTS
SHOWING TABLES
5.
VIEWING STRUCTURE OF
6. TABLE
INSERTING RECORDS
7.
DISPLAY RECORDS USING
8. SELECT CLAUSE
SELECTING SPECIFIC
9. ATTRIBUTE
SELECT USING WHERE
10. CLAUSE

/7

/
1)Write definition of a method COUNTNOW(REGIONS) to find
and display names of those REGIONS, in which there are less
than or equal to 5 characters.

If the list REGIONS contains [“GOA”,”NEW


DELHI”,”DAMAN”,”CHENNAI”,”BANGALORE”]

Source Code-
def COUNTNOW(REGIONS):
for region in REGIONS:
if len(region) <= 5:
print(region)

REGIONS = ["GOA", "NEW DELHI", "DAMAN",


"CHENNAI", "BANGALORE"]
COUNTNOW(REGIONS)

Output -

GOA
DAMAN
2. Write the definition of a method/function
SearchOut(Teachers, TName) to search for TName
from a list Teachers, and display the position
of its presence.

If the Teachers contain[“Ankit” , “Siddharth”,


“Rahul”, “Sangeeta” , “rahul”] And TName
contains “Rahul”

Source Code -
def SearchOut(Teachers, TName):
for i in range(len(Teachers)):
if Teachers[i].upper() == TName.upper():
print(Teachers[i], " at ", i)

Teachers = ["Ankit", "Siddharth", "Rahul", "Sangeeta", "rahul"]


TName = "Rahul"
SearchOut(Teachers, TName)

Output -

Rahul at 2
rahul at 4
3. Write a function countNow(PLACES) in Python, that
takes the dictionary, PLACES as an argument and displays
the names(in uppercase) of the places whose names are
longer than 5 characters.

PLACES={1:”Delhi”,2:”London”,3:”Paris”,4:”New
York”,5:”Doha”}

Source Code -

def countNow(PLACES):
for key in PLACES:
if len(PLACES[key]) > 5:
print(PLACES[key].upper())

PLACES = {1: "Delhi", 2: "London", 3: "Paris", 4: "New


York", 5: "Doha"}
countNow(PLACES)

Output -

LONDON
NEW YORK
4) Python program to read a file containing email addresses separated
by spaces and display those email addresses ,belong to Gmail domain

Content of the file -

[email protected] [email protected] [email protected] [email protected]

Source Code -

f = open("Emails.txt", 'r')

data = f.read()

print(data)

words = data.split()

print(words)

for word in words:

if '@gmail' in word:

print(word)

f.close()

Output -

[email protected] [email protected] [email protected] [email protected]

['[email protected]', '[email protected]', '[email protected]', '[email protected]']

[email protected]

[email protected]

[email protected]

[email protected]
5) Write a Python program to read words from a file and print only those
words whose length is greater than 5.

Content of the file -

Presidency The International School

Source Code -

f = open("Words.txt", 'r')

data = f.read()

print(data)

words = data.split()

print(words)

for word in words:

if len(word) > 5:

print(word)

f.close()

Output-

Presidency The International School

['Presidency', 'The', 'International', 'School']

Presidency

International

School
6) Write a Python program to read lines from a file and print only the
lines containing the '@' symbol

Content of the file -

@Presidency The International School.

Welcome to class XII

Source Code -

def Countlines():

f = open("content.txt", 'r')

data = f.readlines()

print(data)

for line in data:Write a Python program to read lines from a file and print only the lines
containing the '@' symbo if '@' in line:

print(line)

f.close()

Countlines()

Output -

['@Presidency The International School.\n', 'Welcome to class XII']


@Presidency The International School.
7)Write a Python program to check runs conceded in each over
from a list. Print "Maiden Over" if the runs are 0, otherwise print
"Not Maiden".

Source Code -

for I in Runs:

if I==0:

print('Maiden Over')

else:

print("Not Maiden”)

List -

Runs = [0, 5, 0, 12]

Output -

Maiden Over

Not Maiden

Maiden Over

Not Maiden
8)Write a Python program that takes a word as input and
prints "Ok" if the word is "Hello", otherwise prints "Not
Ok".

Source Code -

W = input("Enter a word: ")

if W == 'Hello':

print('Ok')

else:

print('Not Ok')

Output -

If the user enters Hello

Ok

If the user enters hi

Not Ok
9)Print a pattern of dollar signs for even numbers from 2 to 6,
repeating the dollar sign according to each number.

Source code -

for i in range(2,7,2):
print(i* '$')

Output-

$$
$$$$
$$$$$$

10)Given the string a = "Year 2022 at All the best", split it by


the character '2' and combine the first, second, and fourth parts with
dots between them. What is the output?
Source Code -

a="Year 2022 at All the best"


a=a.split('2')
b=a[0]+"."+a[1]+"."+a[3]
print(b)

Output -

Year .. at All the best


1)CREATING A DATABASE

2)SHOWING DATABASES

3)USING A DATABASE

4) CREATING TABLES WITH CONSTRAINTS


5)SHOWING TABLES

6)VIEWING STRUCTURE OF TABLEUPDATE Students

7. INSERTING RECORDS
8. DISPLAY RECORDS USING SELECT CLAUSE

9. SELECTING SPECIFIC ATTRIBUTE


10. SELECT USING WHERE CLAUSE

You might also like