0% found this document useful (0 votes)
6 views35 pages

Cs File Bhavya

The document outlines a series of practical programming tasks, each with specific aims related to Python programming and SQL queries. Tasks include counting letters in a string, calculating factorials, demonstrating variable scope, file handling, and database operations. Each practical includes an aim, input, and output sections, but lacks specific input and output details.

Uploaded by

vridhi189
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)
6 views35 pages

Cs File Bhavya

The document outlines a series of practical programming tasks, each with specific aims related to Python programming and SQL queries. Tasks include counting letters in a string, calculating factorials, demonstrating variable scope, file handling, and database operations. Each practical includes an aim, input, and output sections, but lacks specific input and output details.

Uploaded by

vridhi189
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/ 35

PRACTICAL 1

AIM:Write a program that accepts a string as a parameter to a


function and counts the number of uppercase letters and lowercase
letters.
Input:-

Output:-
PRACTICAL 2
AIM:Write a Python program to find the factorial of a number
using default parameters. (Include proper error condition for a
negative number as input.)
Input:-

Output:-
PRACTICAL 3
AIM:Write a program to demonstrate the concept of the scope of a
variable.
Input:-

Output:-
PRACTICAL 4
AIM:Write a program to create a function menu() which passes List as an
argument and displays the following menu and does the operation accordingly.
1. Count and print ARMSTRONG numbers.
2. Count and print Prime Numbers
3. Exit
Input:-
Output:-
PRACTICAL 5
AIM: Write a function insert(L,num,pos) that accepts a list,a number and a
position where number is to be added and then add the number in the list.Use
try and except to check that position is valid otherwise display error message.
Input:-

Output:-
PRACTICAL 6
AIM: Read a text file line by line and display each word separated
by a #

Input:-

Output:-
PRACTICAL 7
AIM: Read a text file and display the no. of
vowels/consonants/uppercase/lowercase characters in file?
Input:-

Output:-
PRACTICAL 8

AIM: Remove all the lines that contains the character ‘a’ in a file
and write it to another file
Input:-

OUTPUT
PRACTICAL 9
AIM: Create a binary file with name and roll number.Search for
given roll number and display the name, if not found display
appropriate message.
Input:-
Output:-
PRACTICAL 10

AIM; Create a binary file with roll no. name and marks.Input a roll
no. and update the marks
Input:-

-
PRACTICAL 11

AIM: Write a Random number generator that generates random


numbers between 1 and 6
Input:-

Output:-
PRACTICAL 12

AIM: Write a python program to implement a stack using list.


Input:-

Output:-
PRACTICAL 13

AIM: Create a CSV file by entering user id and password, read and
search the password for given userid
Input:-

Output:-
PRACTICAL 14

AIM: Consider the following DEPT and WORKER tables.


Write
SQL queries for (i) to and (iv) find outputs for SQL

(i) To display Wno, Name, Gender from the table WORKER in


descending order of Who.
(ii) To display the Name of all the FEMALE workers from the
table
WORKER.
(iii) To display the Wno and Name of those workers from the
table WORKER who are born between 1987-01-01' and
'1991-12-01'. (iv) To count and display MALE workers who
have joined after '1986-01-01".
(v) SELECT COUNT(), DCODE FROM WORKER GROUP
BY
DCODE HAVING COUNT()>1;
(vi) SELECT DISTINCT DEPARTMENT FROM DEPT;
(vii) SELECT NAME, DEPARTMENT, CITY FROM
WORKER W,
DEPT D WHERE W.DCODED.DCODE AND WINO < 1003;
SELECT MAX(DOJ), MIN(DOB) FROM WORKER;
OUTPUT:
(i)

(ii)
(iii)

(iv)

(v)
(vi)

(vii)

(viii)
PRACTICAL 15

AIM: Write SQL commands for the statements (i) to (iv) and
give outputs for SQL queries (v) to (vii)

OUTPUT:
(i)
(ii)

(iii)
(iv)

(v)

(vi)

(vii)
PRACTICAL 16

AIM: Write SQL commands for the following on the basis of


given table MOV

i. Display a list of all movies with Price over 20 and sorted by


Price
ii. Display all the movies sorted by QTY in decreasing
order
iii.Display a report listing a movie number, current value
and replacement value for each more the above table.
Calculate the replacement value for all movies as QTY
Price 1.15
OUTPUT:
(i)
(ii)

(iii)
PRACTICAL 17

AIM: Write SQL commands for the following on the basis of


given table Teacher

i. To show all information about the teacher of history


department
ii. To list the names of female teachers who are in Hindi
department
iii. To list names of all teachers with their date of joining in
ascending order
OUTPUT:
(i)

(ii)
(iii)
PRACTICAL 18
AIM: Write SQL commands for the following on the basis of
given table STUDENT

(i) Display the names of the students who are getting a


grade
'C' in either GAME or SUPW
(ii) Display the different games offered in the school.
(iii) Display the SUPW taken up by the students, whose
name starts with ‘A’.
OUTPUT:
(i)
(ii)

(iii)
PRACTICAL 19
AIM: Write a Python program that displays first three rows
fetched from student table of MySQL database "test".

SOURCE CODE:

OUTPUT:
PRACTICAL 20
AIM: Write a Python database connectivity script that deletes
records from category table of database items that have
name='Stockable’

SOURCE CODE:
OUTPUT:
PRACTICAL 21

AIM: Kabir wants to write a program in python to insert the


following record in the table named Student in MYSQL
database, SCHOOL.
• Rno (roll no)- integer
• Name- string
• DOB – date
• Fee – float

Note the following to establish connection between python


and SQL.

• Username – root
• Password – tiger
• Host – localhost
The values of fields Rno, name, fee and DOB has to be accepted from the user.
Help Kabir to write the program in python
SOURCE CODE:
OUTPUT:

You might also like