File

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 28

DATE OF SUBMISSION:-_______________

SHRI DAULAT RAM PUBLIC SR. SEC. SCHOOL

*NAME- tanya
*CLASS- XII (NON MEDICAL)
*ROLL NO-
*SESSION-2024-2025

****************************************************
*********
COMPUTER SCIENCE
PROJECT FILE
SUBMITTED TO:- MISS. NISHA

****************************************************
*********
Acknowledgment

I would like to express my special


thanks of gratitude to my teacher Nisha
Mam and my school who gave me the
golden opportunity to do this wonderful
project in Python. This project helped
me to learn more about the Python
language and its different features.
PROGRAMS

Ques:1 – W.A.P. to shift elements of a list so that the first element moves to the
second index the second index moves to the third index, and so on, and the last
element shifts to the first position.
Suppose the list is [10,20,30,40].
After shifting, it should look like: [40,10,20,30].

*** source code ***

*** Output ***

Ques 2: W.A.P. will input ‘n’ classes and the names of class teachers to
store them in a dictionary and display them. Also, accept a particular
class from the user and display the name of the class teacher of that
class.
*** source code ***

*** output ***

Ques 3:- W.A.P. to change a given string to a new string where the first
and last characters have been exchanged.
*** Source code ***

*** OUTPUT ***


Ques 4:- W.A.P. to generate and print a list of the
first and last 5
elements where the values are squares of numbers between 1
and 30 (both included).

*** source code ***

*** Output ***


Ques 5:- W.A.P. to combine two dictionaries adding values for common
keys.
d1 = {‘a’: 100, ’b’: 200, ‘c’: 300}
d2 = {‘a’ : 300, ’b’ : 200, ‘d’ : 400}

*** source code ***

*** output ***


Ques 6 - Write a function called calculate_area() that takes base and
height as input arguments and returns the area of a triangle as an
output.

*** source code ***

*** OUTPUT ***

Ques 7 - W.A.P. to count the words “to” and “the” present in a


text file “Poems.txt”.
*** source CODE ***

*** TEXT FILE ***


*** OUTPUT ***
W.A.P. to count the number of uppercase alphabets
Ques 8 -
present in a text file “Poems.txt”.

*** source code ***

*** text file ***

*** output ***


Ques 9 - W.A.P. to search the names and addresses of persons
older than 30 in the data list of persons.
*** source code ***
*** text file ***

*** output ***

Ques 10 - Write a function in Python to count and display the


number of lines starting with the alphabet 'A' present in a text
file " LINES.TXT". e.g., the file "LINES.TXT" contains the following
lines:
The boy is playing there.
There is a playground.
An airplane is in the sky.
Alphabets & numbers are allowed in the password.
The function should display the output as 3.

*** source code ***

*** text file ***

*** output ***


Ques 11 - Write a method in Python to write multiple lines of text
contents into a text file mylife.txt.
*** source code ***
*** text file ***

*** output ***

Ques 12 – WAP will write the record in the binary file.


*** source code ***
*** output ***

***binary file***
Ques 13 - WAP to read the record in the binary file.
*** source code***
*** output ***

Ques -14 - WAP will search the student record by their roll no. in
a binary file.
*** SOURCE CODE ***
*** output ***

Ques 15- WAPwill delete the student's record by roll


no. in a binary file.
*** source code ***
*** output ***

*** binary file ***

Ques 16 - Create a CSV file "Groceries" to store information on items


existing in a shop. The information is to be stored w.r.t. each item
code, name, price, qty. Write a program to accept the data from
the user and store it permanently in a CSV file.
*** source code ***

*** output ***

*** Excel file ***


Ques 17 - WAP will write data onto the “student” CSV file
using the writerow() method.
*** source code ***

*** output ***


*** excel file before ***

*** excel file after ***


Ques 18 - WAP to count the exact number of records present in
the CSV file excluding the header.
*** source code ***

*** output ***

*** Excel file ***

You might also like