0% found this document useful (0 votes)
31 views8 pages

Functions, SQL and Revision - Python - Tour

The document outlines a practical program list for XII students at Delhi Private School, Sharjah for the academic year 2023-2024. It includes various Python programming tasks, such as calculating areas, checking prime numbers, and manipulating strings and lists, as well as SQL queries for database management. Additionally, it covers practical exercises involving tuples, dictionaries, and data handling in MySQL for students to develop their programming and database skills.

Uploaded by

gamerace30max
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)
31 views8 pages

Functions, SQL and Revision - Python - Tour

The document outlines a practical program list for XII students at Delhi Private School, Sharjah for the academic year 2023-2024. It includes various Python programming tasks, such as calculating areas, checking prime numbers, and manipulating strings and lists, as well as SQL queries for database management. Additionally, it covers practical exercises involving tuples, dictionaries, and data handling in MySQL for students to develop their programming and database skills.

Uploaded by

gamerace30max
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

DELHI PRIVATE SCHOOL,SHARJAH XII – PRACTICAL PROGRAM LIST (2023-2024)

1. Revision Tour:-
Write a program in python to calculate Area and Circumference of a circle as per the
following requirements:-

a) Main program to accept 3 radius and print the results using the bigger radius as an
argument. Repeat the process based on user’s choice.

b) A function big_two() to accept 2 parameters and return the bigger of 2 numbers

c) A function big_three() to accept 3 parameters and return the bigger of 3 numbers by


invoking the function big_two().

d) A function cal() to accept radius as parameter and return area and circumference.

2. Revision Tour (Loop) :-

Write a program in python to accept an integer no and perform the following operations:-

a) Main program to accept an integer number to check prime , palindrome and print
multiplication table. Repeat the process based on user’s choice.

b) A function prime() to accept a number as a parameter and print whether the number is
prime or not.

c) A function palindrome() to accept a number as a parameter and print whether the number
is palindrome or not.

d) A function multi() to accept a number as a parameter and print multiplication table for 10
times.

3. Revision Tour (modules –math, random, statistics) :-

Write a program in python to perform various operation using different modules :-

a) Main program to accept no of terms and access functions based on user’s choice. Repeat
the process until the user want to stop the program.

b) A function generate() to accept n as parameter and generate ‘n’ random numbers


randomly
and save in a tuple as a global variable.
DELHI PRIVATE SCHOOL,SHARJAH XII – PRACTICAL PROGRAM LIST (2023-2024)
c) A function show() to accept the tuple through parameter and display all the numbers.

c) A function stat() to accept the tuple through parameter and perform the following
operations using built in functions:-sorted, mean and median.

4. Revision Tour (Strings)

a) Main program to accept no of terms and access functions based on user’s choice.
Repeat
the process until the user want to stop the program.

b) A function to accept string as a parameter and check whether the string is palindrome
or not. If it is return True else return False
c) A function to accept string as a parameter and display each word in reverse order

d) A function that accepts two strings as parameter and check the second string is
present in first string. If it is return ‘P’ otherwise return ‘A’

e) A function that accepts two strings as parameter and display the uncommon words
from
two strings in a list.
f) A function that accepts a strings and d as parameter and display String slicing in
Python to rotate a string

Given two sentences as strings A and B. The task is to return a list of all uncommon
words. A word is uncommon if it appears exactly once in any one of the sentences, and does
not appear in the other sentence.

Example: Input : A = "Geeks for Geeks"


B = "Learning from Geeks for Geeks"
Output : ['Learning', 'from']

Example: Given a string of size n,


Left (Or anticlockwise) rotate the given string by d elements (where d <= n).
Right (Or clockwise) rotate the given string by d elements
(where d <= n).
Input : s = "GeeksforGeeks"
d=2
Output : Left Rotation : "eksforGeeksGe"
Right Rotation : "ksGeeksforGee”
DELHI PRIVATE SCHOOL,SHARJAH XII – PRACTICAL PROGRAM LIST (2023-2024)
5. Revision Tour (Lists)

a) Python menu driven program for the following and make separate functions for each and
pass necessary parameters.

a) to print duplicates and unique elements from a list of integers


b) to find Cumulative sum of a list
Input : list = [10, 20, 30, 40, 50]
Output : [10, 30, 60, 100, 150]

Input : list = [4, 10, 15, 18, 20]


Output : [4, 14, 29, 47, 67]

6. Revision Tour (Tuples)


a) Create a list of tuples from given list having number and its cube in each tuple
Input: list = [1, 2, 3]
Output: [(1, 1), (2, 8), (3, 27)]

Input: list = [9, 5, 6]


Output: [(9, 729), (5, 125), (6, 216)]
b) Sort a list of tuples by second Item
Input : [('for', 24), ('Geeks', 8), ('Geeks', 30)]
Output : [('Geeks', 8), ('for', 24), ('Geeks', 30)]

Input : [('452', 10), ('256', 5), ('100', 20), ('135', 15)]


Output : [('256', 5), ('452', 10), ('135', 15), ('100', 20)]

7. Revision Tour (Dictionary)

a) Write a function that accepts a string and number of frequency of each character
from a string stored in a dictionary. For example if string is “google “ then output is
{‘g’:2,’o’:2,’l’:1,’e’:1}

b) Write a function that accepts a string and store the words in a list that starts with the
starting letter of the word’
For example
if string is “there is a monkey in the zoo”
{‘t’:[‘there’,’the’],’i’:[‘is’,’in’],’a’:[‘a’],’m’:[‘monkey’],’z’:[‘zoo’]}

PROGRAM USING FUNCTIONS

1 WAF to check a number is even or odd, if it is even return true, else return false
2 WAF to display the smallest of 3 numbers
DELHI PRIVATE SCHOOL,SHARJAH XII – PRACTICAL PROGRAM LIST (2023-2024)
3 WAF to display first ‘n’ even numbers in ascending order
4 WAF to display first ‘n’ odd numbers in descending order.
5 WAF to convert a binary number to decimal number
MYSQL

Table 1: STUDENT
RollN Name Stipend Stream Avgmarks Grade Class
o
1 Karan 400 Medical 78 B 12
2 Divakar 450 Commerce 45 D 11
3 Anil 399 Humanities 67 C 11
4 Vikas 500 Commerce 74 B 12
5 Manu 650 Medical 89 A 11
1. Display list of all the commerce stream students from the table.
2. List the names of students who are in grade 12 sorted by stipend in ascending
order.
3. List the details of all students sorted by Avgmarks in descending order within class
in ascending order.
4. Display a report listing name, stream and stipend received in a year assuming that
stipend is paid every month.
5. To count the number of students with grade C.
6. To display sum of Avgmarks for B grade students.
7. To display sum of stipend by grade.
8. To display details of students whose name starts with ‘V’.
9. To display details of students who have opted for medical stream.
10. Add a new column Section to the table Student.

Table 2: EMPLOYEE
Eno Ename Designation Department
MG01 Arina Manager Logistics
MG02 Devisha Manager Sales
CR09 Henry Clerk Logistics
OF01 Angel Officer Reception
MG03 Priyam Clerk Personnel

ACCOUNT
Eno Basic DA Tax
MG01 8000 3200 800
MG02 8500 3400 850
CR09 6200 2480 248
OF01 7500 3000 300
MG03 6000 2400 240
DELHI PRIVATE SCHOOL,SHARJAH XII – PRACTICAL PROGRAM LIST (2023-2024)

1. To display Ename and Department of persons working as Manager.


2. To display Ename and net income of all persons (net income=Basic+DA-tax).
3. To display Ename and Basic of all persons whose basic is greater than 7000.
4. To display count of people working as Manager.
5. To insert a new row into the table having values as
(“OF03”,”Ruban”,”Officer”,”Sales”).
6. To increment the value of DA by 25% of the existing value for all employees
whose DA is less than 3000.

Table 3: MOVIE
Movieid Moviename Actor Type Cost Language Number
F001 Terminator Schwazneger Fiction 250 English 5
R001 Hum Tum Saif Ali Romance 150 Hindi 3
A005 The Mask Jim Carey Comedy 200 English 4
A115 Bruce Jum Carey Comedy 250 English 5
Almighty
A007 Black Rani Social 150 Hindi 3

ISSUED
Movieid Qty_Issued
A005 2
R001 1
A115 3

1. To display moviename, actor and cost of all English movies.


2. To list the names of all comedy movies.
3. To display the moviename, cost of movies in ascending order of cost.
4. To increase the price of all comedy movies by 50.
5. To insert a new row into the table.
6. To display names of movies starting with T.
7. To display details of all 5 lettered movies in the movie table.

Table 4: INSURANCE
Company Type Years Name Coverage
CUF Car 15 Care safe 80000
LIT Life 40 Insured Life policy 200000
HC House 25 House Secure policy 550000
URFree Life 35 Life Insurance 750000
Care Child 25 Future Child 500000

1. Give the name and type of all companies whose coverage is more than 100000 but
less than 700000.
2. List the name, company and years of all those whose type is life and years are more
than 20.
DELHI PRIVATE SCHOOL,SHARJAH XII – PRACTICAL PROGRAM LIST (2023-2024)
3. List the different types of policies.
4. Calculate the average coverage of all the policies.
5. List the name in descending order of coverage.
6. Display the sum of coverage on the basis of type.
7. Display the details of all companies whose insurance years range from 20 to 30
years.
8. Add a new row to the table insurance.

Table 5: BATSMAN

Player Match Runs Century Halfcentury Average Age


[Link] 85 3456 16 12 56.7 21
Rama 112 7642 23 20 72.7 26
[Link] 36 1950 7 12 42.2 28
[Link] 106 4756 11 19 45.3 30
Aryan 20 958 8 5 53.2 19

1. List the names of all batsmen whose average is more than 50.
2. List details of batsmen whose age is between 18 and 25.
3. List the details of batsmen whose centuries exceed half centuries.
4. Display details of batsman whose average is greater than 50.
5. Insert a new record into the table.
6. Display details of batsman whose name starts with R.
7. Display details of batsman in descending order of matches.
8. Add a new column Wickets taken to the table batsman.
9. To count the number of batsman whose no of halfcentury exceeds 15.

Table 6 : PREPAID
No Cname Model Connect Activation Date Validity Amount
1 Sita Nokia Airtel 2004-06-04 365 3300
2 Ramesh Nokia Hutch 2005-02-12 60 890
3 Reena Samsung Idea 2004-05-14 180 560
4 Meethali LG Airtel 2004-09-24 30 600
5 Ramanuj Sony Reliance 2004-10-16 90 900
6 Karan LG Idea 2005-02-02 60 300

1) To display Cname and Amount of customers having “Nokia” model and “Hutch”
connection arranged in descending order of amount.
2) To display the different types of connection available.
3) To display the sum of validity for each type of connection grouping.
4) To display Cname, Connect of all the people whose date of activation started in
the month of February 2005.
5) To display details of customers whose activation date is in the year 2005
6) To add a new row to the table.
7) To add a new column Surname to the table prepaid.
DELHI PRIVATE SCHOOL,SHARJAH XII – PRACTICAL PROGRAM LIST (2023-2024)
8) To display the details of people with name starting with R.

Table 7 : BOOKS

Bid Bname Autname Publ Price Type Quantity


C001 Fast Cook Lata K EPB 355 Cookery 5
F005 The Tears William H First Publ 650 Fiction 20
T008 My First C++ Brian Brok EPB 350 Text 10
F002 Thunderbolts Anna Robs First Publ 750 Fiction 50
T003 C++ Codes Rossaine A TDH 300 Text 5
RELATION : ISSUED
Bid QIssued
T008 4
C001 5
F005 2

Write SQL commands for questions i) to v) and state output for questions vi) to ix):-
i) To list the names of books of Text type.
ii) To display name and price of books in descending order of price.
iii) To display details of books having the highest price.
iv) To display maximum price of books based on their type.
v) To display Bid,Bname and QIssued for all books which have been issued.
vi) SELECT COUNT(DISTINCT Publ) FROM BOOKS;
vii) SEELCT MAX(Quantity) FROM BOOKS;
viii) SELECT Bname,Autname FROM BOOKS WHERE Publ=’EPB’.
ix) SELECT COUNT(*) FROM BOOKS WHERE PRICE IS BETWEEN 300 AND
400.

TABLE 8: ACTIVITY

Acode Activityname Noofparticipant Prizemoney Scheduledate


s
1001 Relay 4*100 16 16000 23/01/2004
1005 Highjump 10 10000 12/12/1003
1002 Shortput 12 6000 14/02/2004
1003 Longjump 12 9000 01/01/2004
1008 Discussthrow 10 8000 19/03/2004

i) To display name of all activities with their Acodes in descending order.


ii) To display sum of Prizemoney for each Noofparticipants groupings.
iii) To display Activityname and Noofparticipants whose schedule date is in the year
2004.
iv) To display details of activities whose prizemoney is between 10000 and 20000.
v) To add a new column Coachname to the table ACTIVITY
DELHI PRIVATE SCHOOL,SHARJAH XII – PRACTICAL PROGRAM LIST (2023-2024)
vi) To display the names of the different activities provided.

TABLE 9 : PARTTIME

Empid Ename Stipen Profession Dateofjoining Grade


d
1002 Karan 1000 Accounts 2007-02-23 A
1005 Manu 2000 Medical 2006-12-12 A
1001 Kamal 800 Clerical 2007-02-06 C
1008 Vikas 500 Clerical 2006-11-18 D
1003 Anil 1200 Medical 2007-08-04 B

i) List the details of all employees sorted by stipend in descending order.


ii) To display details of employees whose name starts with ‘A’.
iii) To display sum of stipend for each grade groupings.
iv) To display details of employees who have joined in the year 2007.
v) To add a new column Noofhoursworked to the table PARTIME.

You might also like