Xii Practical File
Xii Practical File
NO: 1
DATE:
CREATING A MENU DRIVEN PROGRAM TO PERFORM ARITHMETIC
OPERATIONS
AIM:
To write a menu driven Python Program to perform Arithmetic operations (+,-*,/) based on the
user’s choice.
SOURCE CODE:
1
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully.
2
EX.NO: 2
DATE:
CREATING A PYTHON PROGRAM TO DISPLAY FIBONACCI SERIES
AIM:
To write a Python Program to display Fibonacci Series up to ‘n’ numbers.
SOURCE CODE:
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully.
3
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:
4
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
5
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:
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
6
EX.NO: 5
DATE:
AIM:
To write a Python program to implement python mathematical functions to find:
(i) To find Square of a Number.
(ii) To find Log of a Number (i.e. Log10)
(iii) To find Quad of a Number
SOURCE CODE:
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
7
EX.NO: 6
DATE:
AIM:
To write a Python program to generate random number between 1 to 6 to simulate the
dice.
SOURCE CODE:
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
8
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:
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
9
EX.NO: 8
DATE:
AIM:
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:
SAMPLE OUTPUT:
Story.txt:
Result:
Thus, the above Python program has been executed and the output is verified successfully
10
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:
SAMPLE OUTPUT:
poem.txt:
Result:
Thus, the above Python program has been executed and the output is verified successfully
11
EX.NO: 10
DATE:
AIM:
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:
SAMPLE OUTPUT:
Python Executed Program output:
Sample.txt:
New.txt:
Result:
Thus, the above Python program has been executed and the output is verified successfully
12
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:
13
SAMPLE OUPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
14
EX.NO: 12
DATE:
AIM:
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:
15
SAMPLE OUPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
16
EX.NO: 13
DATE:
CREATING A PYTHON PROGRAM TO CREATE AND SEARCH EMPLOYEE’S RECORD IN CSV FILE
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:
17
SAMPLE OUPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
18
EX.NO: 14
DATE:
AIM:
To write a Python program to implement Stack using a list data-structure, to perform
the following operations:
(i) To Push an object containing Doc_ID and Doc_name of doctors who specialize in "ENT" to
the stack.
(ii) To Pop the objects from the stack and display them.
(iii) To display the elements of the stack (after performing PUSH or POP)
SOURCE CODE:
19
SAMPLE OUPUT:
PYTHON PROGRAM EXECUTED OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
20
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:
21
SAMPLE OUPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
22
EX.NO: 16
DATE:
AIM:
To write a Python Program to integrate MYSQL with Python to create Database and Table
to store the details of employees
SOURCE CODE:
23
Sample Output:
Result:
Thus, the above Python program has been executed and the output is verified successfully
24
EX.NO: 17
DATE:
AIM:
To write a Python Program to integrate MYSQL with Python by inserting records to Emp
table and display the records.
SOURCE CODE:
25
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
26
EX.NO: 18
DATE:
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:
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
27
EX.NO: 19
DATE:
AIM:
To write a Python Program to integrate MYSQL with Python to search an Employee using
EMPID and update the Salary of an employee if present in already existing table EMP, if not
display the appropriate message
SOURCE CODE:
28
SAMPLE OUTPUT:
Result:
Thus, the above Python program has been executed and the output is verified successfully
29
EX.NO: 20
DATE:
SQL COMMANDS EXERCISE - 1
AIM:
To write Queries for the following Questions based on the given table:
USE STUDENTS;
(e) Write a Query to List all the tables that exists in the current database.
SHOW TABLES;
30
EX.NO: 21
DATE:
SQL COMMANDS EXERCISE - 2
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'.
SELECT * FROM STU;
Output:
31
(c) Write a query to Rollno, Name and Department of the students from STU table.
Output:
32
EX.NO: 22
DATE:
SQL COMMANDS EXERCISE - 3
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:
33
(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:
34
EX.NO: 23
DATE:
SQL COMMANDS EXERCISE - 4
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.
35
(c) Write a Query to add a new column Area of type varchar in table STU.
ALTER TABLE STU ADD AREA VARCHAR(20);
Output:
(d) Write a Query to Display Name of all students whose Area Contains NULL.
(e) Write a Query to delete Area Column from the table STU.
36
EX.NO: 24
DATE:
SQL COMMANDS EXERCISE - 5
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:
37
(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:
*******************************************************
38