Paresh Kohli 12096 12B

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

LANCER’S CONVENT

SECTOR 14,ROHINI,PRASHANT VIHAR ROAD


DELHI -110085

COMPUTER SCIENCE
PRACTICAL FILE
(2022-2023)

NAME : PARESH KOHLI


CLASS & SECTION : 12 B
ADMISSION NUMBER : 12096

PARESH KOHLI 12TH B CS


1
PRACTICAL FILE
Q1- WRITE A PROGRAM THAT ACCEPTS A
STRING AS A PARAMETER TO A FUNCTION AND
COUNTS THE NUMBER OF UPPER CASE LETTERS
AND LOWER CASE LETTERS:
INPUT:

OUTPUT:

PARESH KOHLI 12TH B CS


2
PRACTICAL FILE
Q2-WRITE A PYTHON PROGRAM TO FIND THE
FACTORIAL OF A NUMBER. PROVIDE THE
FUNCTION WITH DEFAULT PARAMETERS IF NO
USER INPUT IS PROVIDED.(FACTORIAL OF
NEGATIVE NUMBERS IS NOT POSSIBLE.
INPUT:

OUTPUT:

PARESH KOHLI 12TH B CS


3
PRACTICAL FILE
Q3-WRITE A PROGRAM TO
DEMONSTRATE THE CONCEPT OF SCOPE
OF A VARIABLE.
INPUT:

OUTPUT:

PARESH KOHLI 12TH B CS


4
PRACTICAL FILE
Q4- WRITE A PYTHON FUNCTION TO CREATE
AND PRINT A LIST WHERE THE VALUES OF THE
LIST ARE SQUARES OF NUMBERS BETWEEN 1
AND 30 (BOTH INCLUDED

INPUT:

OUTPUT:

PARESH KOHLI 12TH B CS


5
PRACTICAL FILE
Q5- WRITE A PROGRAM TO INPUT 10 NUMBERS
FROM THE USER AND COUNT HOW MANY OF
THESE ARE WHOLE NUMBERS.

INPUT:

OUTPUT:

PARESH KOHLI 12TH B


6
CS PRACTICAL FILE
Q6- CREATE A FUNCTION CALCULATOR
TO PERFORM BASIC MATHEMATICAL
OPERATIONS AND RETURN MULTIPLE
VALUES AND PRINT THEM INDIVIDUALLY.
INPUT:

OUTPUT:

PARESH KOHLI 12TH B


CS PRACTICAL FILE 7
Q7. READ A TEXT FILE LINE BY LINE AND
DISPLAY EACH WORD SEPARATED BY A #.

TEXT:

CODE:

OUTPUT:

PARESH KOHLI 12TH B CS


8
PRACTICAL FILE
Q8. READ A TEXT FILE AND DISPLAY THE
NUMBER OF VOWELS/CONSONANTS/
UPPERCASE/LOWERCASE/
CHARACTERS IN THE FILE .
CODE:

OUTPUT:

PARESH KOHLI 12TH B CS


9
PRACTICAL FILE
Q9. COPY THE CONTENTS OF ONE TEXT
FILE TO ANOTHER TEXT FILE BY
REMOVING ALL THE LINES THAT
CONTAIN THE CHARACTER ‘a’.
CODE:

TEXT FILE:

OUTPUT:

PARESH KOHLI 12TH B CS


10
PRACTICAL FILE
Q10. WAP TO READ A TEXTFILE AND
DISPLAY EACH WORD STARTING FROM
THE SECOND LETTER.

CODE:

TEXT FILE :

OUTPUT:

PARESH KOHLI 12TH B CS


11
PRACTICAL FILE
Q11) CREATE A BINARY FILE WITH NAME AND
ROLL NUMBER. SEARCH FOR A GIVEN ROLL
NUMBER AND DISPLAY THE NAME, IF NOT
FOUND DISPLAY APPROPRIATE MESSAGE .
CODE:

PARESH KOHLI 12TH B CS


12
PRACTICAL FILE
OUTPUT:

PARESH KOHLI 12TH B CS


13
PRACTICAL FILE
Q12. CREATE A BINARY FILE WITH ROLL
NUMBER , NAME AND MARKS .INPUT A
ROLL NUMBER AND UPDATE MARKS.

CODE:

PARESH KOHLI 12TH B CS


14
PRACTICAL FILE
OUTPUT:

PARESH KOHLI 12TH B CS


15
PRACTICAL FILE
Q13. WRITE A RANDOM NUMBER
GENERATOR THAT GENERATES RANDOM
NUMBERS BETWEEN 1 AND 6
(SIMULATES A DICE).
CODE:

OUTPUT:

PARESH KOHLI 12TH B CS


16
PRACTICAL FILE
Q14) WRITE A PROGRAM TO READ THE
CONTENTS OF “STUDENT.CSV” FILE
USING WITH OPEN ().
CODE:

FILE:

PARESH KOHLI 12TH B CS


17
PRACTICAL FILE
OUTPUT:

PARESH KOHLI 12TH B CS


18
PRACTICAL FILE
Q15) CREATE A CSV FILE BY ENTERING
USER-ID AND PASSWORD, READ AND
SEARCH THE PASSWORD FOR GIVEN
USER-ID.
CODE:

PARESH KOHLI 12TH B CS


19
PRACTICAL FILE
FILES:

OUTPUT:

PARESH KOHLI 12TH B CS


20
PRACTICAL FILE
Q16) WRITE A FUNCTION FILE_LONG()
THAT ACCEPTS A FILE NAME AND
REPORTS THE FILE’S LONGEST LINE.

CODE:

TEXTFILE:

OUTPUT:

PARESH KOHLI 12TH B CS


21
PRACTICAL FILE
Q17) WRITE A PROGRAM TO COUNT THE
NUMBER OF RECORDS PRESENT IN
“CUSTOMERS.CSV” FILE.

CODE:

FILES:

PARESH KOHLI 12TH B CS


22
PRACTICAL FILE
OUTPUT:

PARESH KOHLI 12TH B CS


23
PRACTICAL FILE
\\

PARESH KOHLI 12TH B CS


24
PRACTICAL FILE
PARESH KOHLI 12TH B CS
25
PRACTICAL FILE
PARESH KOHLI 12TH B CS
26
PRACTICAL FILE
PARESH KOHLI 12TH B CS
27
PRACTICAL FILE
PARESH KOHLI 12TH B CS
28
PRACTICAL FILE
PARESH KOHLI 12TH B CS
29
PRACTICAL FILE
PARESH KOHLI 12TH B CS
30
PRACTICAL FILE
PARESH KOHLI 12TH B CS
31
PRACTICAL FILE
PARESH KOHLI 12TH B CS
32
PRACTICAL FILE
PARESH KOHLI 12TH B CS
33
PRACTICAL FILE
PARESH KOHLI 12TH B CS
34
PRACTICAL FILE
PARESH KOHLI 12TH B CS
35
PRACTICAL FILE
PARESH KOHLI 12TH B CS
36
PRACTICAL FILE
PARESH KOHLI 12TH B CS
37
PRACTICAL FILE
PARESH KOHLI 12TH B CS
38
PRACTICAL FILE

You might also like