Bhavya 12C C.S File
Bhavya 12C C.S File
Submitted To : Submitted By
Mrs. Sapna Anand Name : Bhavya Tiwari
PGT (C.S./I.P.) Class : XII C
Roll no :
Signature
TABLE OF CONTENTS
NEW YORK
29 Write a function, lenWords(STRING), that takes a string as an argument and
returns a tuple containing length of each word of a string.
For example, if the string is "Come let us have some fun", the tuple will have
(4, 3, 2, 4, 4, 3)
30 Write a function dispBook(BOOKS) in Python, that takes a dictionary BOOKS
as an argument and displays the names in uppercase of those books whose
name starts with a consonant.
For example, if STRING = "Learning history helps to know about history with
interest in history" and SEARCH = 'history', the function should display the
word history occurs 3 times.
32 Write a function in Python PUSH(Arr), where Arr is a list of numbers. From
this list push all numbers divisible by 5 into a stack implemented by using a
list. Display the stack if it has at least one element, otherwise display
appropriate error message.
33 To write a Python program to implement Stack using a list data-structure, to
perform the following operations:
(b)To Pop the objects from the stack and display them.
(c)To display the elements of the stack (after performing PUSH or POP)
34 To Write a program, with separate userdefined functions to perform the
following operations:
(b)Pop_element(): It pops the objects from the stack and displays them. Also,
the function should display “Stack Empty” when there are no elements in the
stack.
36 Given a Dictionary Stu_dict containing marks of students for three test-series
in the form Stu_ID:(TS1, TS2, TS3) as key-value pairs. Write a Python program
with the following user-defined functions to perform the specified operations
on a stack named Stu_Stk
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
3
OUTPUT:
***************************************************************************************
4
EX.NO: 2
DATE:
AIM:
To write a Python Program to display Fibonacci Series up to ‘n’ numbers.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
5
OUTPUT:
*****************************************************************************************
6
EX.NO: 3
DATE:
AIM:
To write a menu driven Python Program to find Factorial and sum of list of numbers
using function.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
7
OUTPUT:
************************************************************************************************
8
EX.NO: 4
DATE:
AIM:
To Write a Python program to define the function Check(no1,no2) that take two numbers and
Returns the number that has minimum ones digit.
Source Code:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
Output:
**********************************************************************************
9
EX.NO: 5
DATE:
AIM:
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
OUTPUT:
Python Executed Program Output:
***************************************************************************
10
EX.NO: 6
DATE:
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
OUTPUT:
**********************************************************************************
11
EX.NO: 7
DATE:
AIM:
To write a Python Program to Read a text file "Story.txt" line by line and display
each word separated by '#'.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
OUTPUT:
Story.txt:
12
EX.NO: 8
DATE:
To write a Python Program to read a text file "Story.txt" and displays the number of
Vowels/ Consonants/ Lowercase / Uppercase/characters in the file.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
13
OUTPUT:
Story.txt:
***************************************************************************************
14
EX.NO: 9
DATE:
AIM:
To Write a method Disp() in Python, to read the lines from poem.txt and display those
words which are less than 5 characters.
Source Code:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
Output:
Poem.txt:
**********************************************************************************
15
EX.NO: 10
DATE:
To write a python program to read lines from a text file "Sample.txt" and copy those lines
into another file which are starting with an alphabet 'a' or 'A'.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
OUTPUT:
New.txt:
*****************************************************************************************
16
EX.NO: 11
DATE:
AIM:
To write a Python Program to Create a binary file with roll number and name.
Search for a given roll number and display the name, if not found display appropriate
message.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
17
OUPUT:
*******************************************************************************************
18
EX.NO: 12
DATE:
To write a Python Program to Create a binary file with roll number, name, mark
and update/modify the mark for a given roll number.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
19
OUTPUT:
**********************************************************************************
20
EX.NO: 13
DATE:
AIM:
To write a Python program Create a CSV file to store Empno, Name, Salary and search any Empno
and display Name, Salary and if not found display appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
21
OUTPUT:
******************************************************************************
22
EX.NO: 14
DATE:
AIM:
To write a Python program to implement Stack using a list data-structure, to perform
(i) To Push an object containing Doc_ID and Doc_name of doctors who specialize
in "ENT" to the stack.
(ii) (ii) To Pop the objects from the stack and display them.
(iii)
(iv) (iii) To display the elements of the stack (after performing PUSH or POP)
SOURCE CODE:
23
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
OUTPUT:
Python Program Executed Output:
24
****************************************************************************************
25
EX.NO: 15
DATE:
AIM:
To Write a program, with separate user-defined functions to perform the following
operations:
(i) To Create a function Push(Stk,D) Where Stack is an empty list and D is Dictionary of
Items. from this Dictionary Push the keys (name of the student) into a stack,
where the corresponding value (marks) is greater than 70.
(ii) To Create a Function Pop(Stk) , where Stk is a Stack implemented by a list of student
names. The function returns the items deleted from the stack.
(iii) To display the elements of the stack (after performing PUSH or POP).
Source Code:
26
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
Output:
*********************************************************************************
27
EX.NO: 16
DATE:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(CREATING DATABASE AND TABLE)
AIM:
To write a Python Program to integrate MYSQL with Python to create Database and Table
to store the details of employees.
Source Code:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
28
Output:
*******************************************************************************************************
29
EX.NO: 17
DATE:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(INSERTING RECORDS AND DISPLAYING RECORDS)
AIM:
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
30
OUTPUT:
******************************************************************************************************************************************************************************
31
EX.NO: 18
DATE:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(SEARCHING AND DISPLAYING RECORDS)
AIM:
To write a Python Program to integrate MYSQL with Python to search an Employee using
EMPID and display the record if present in already existing table EMP, if not display the
appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
OUTPUT:
32
EX.NO: 19
DATE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
33
OUTPUT:
***************************************************************************************************************************** *********************
34
SQL COMMANDS EXERCISE - 1
Ex.No: 20
DATE:
AIM:
To write Queries for the following Questions based on the given table:
USE STUDENTS;
SHOW DATABASES;
(e) Write a Query to List all the tables that exists in the current database.
SHOW TABLES;
Output:
35
SQL COMMANDS EXERCISE - 2
Ex.No: 21
DATE:
AIM:
To write Queries for the following Questions based on the given table:
(a) Write a Query to insert all the rows of above table into Info table.
(b) Write a Query to display all the details of the Employees from the above table 'STU'.
Output:
36
(c) Write a query to Rollno, Name and Department of the students from STU table.
Output:
Output:
********************************************************************************************
37
Ex.No: 22 SQL COMMANDS EXERCISE - 3
DATE:
AIM:
To write Queries for the following Questions based on the given table:
Output:
(b) Write a Query to list name of the students whose ages are between 18 to 20.
Output:
38
(c) Write a Query to display the name of the students whose name is starting with 'A'.
Output:
(d) Write a query to list the names of those students whose name have second alphabet 'n' in
their names.
Output:
**********************************************************************************************************
39
Ex.No: 23 SQL COMMANDS EXERCISE - 4
DATE:
AIM:
To write Queries for the following Questions based on the given table:
(b) Write a Query to change the fess of Student to 170 whose Roll number is 1, if the existing
fess is less than 130.
Output(After Update):
40
(c) Write a Query to add a new column Area of type varchar in table STU.
Output:
(d) Write a Query to Display Name of all students whose Area Contains NULL.
Output:
(e) Write a Query to delete Area Column from the table STU.
Output:
Output:
*******************************************************************************************
41
Ex.No: 24 SQL COMMANDS EXERCISE - 5
DATE:
AIM:
To write Queries for the following Questions based on the given table:
TABLE: UNIFORM
TABLE: COST
(a) To Display the average price of all the Uniform of Raymond Company from table COST.
Output:
(b) To display details of all the Uniform in the Uniform table in descending order of Stock date.
Output:
42
(c) To Display max price and min price of each company.
Output:
(d) To display the company where the number of uniforms size is more than 2.
Output:
(e) To display the Ucode, Uname, Ucolor, Size and Company of tables uniform and cost.
Output:
*****************************************************************************************
43