Xii Cs Practical File kv2 2023-24
Xii Cs Practical File kv2 2023-24
Code:
Output :
Practical 2
Aim:To write a python program to pass list to a function and
double the odd values and half even values of a list and display
list element after changing.
Code:
Output :
Practical 3
Aim:To write a Python program input n numbers in tuple and
pass it to function to count how many even and odd numbers are
entered.
Code:
Output :
Practical 4
Aim:To write a Python program to function with key and
value, and update value at that key in dictionary entered by user.
Code:
Output :
Practical 5
Aim:To write a Python program to generator (Random
Number) that generates random numbers between 1 and 6
(simulates a dice) using user defined function.
Code:
Output :
Practical 6
Aim:To write a python program to implement python string
functions.
Code:
Output:
Practical 7
Aim: To write a python program to read and display text
file content line by line with each word separated by #.
Code:
Text File used:
Output:
Practical 8
Aim: To write a python program read a text file and display the
number of vowels, digits, consonants, uppercase, lowercase
consonants in a text file.
Code:
Text file used:
Output:
Practical 9
Aim: To write a python program to count spaces, digits, words
and lines from text file.
Code:
Text file used:
Output:
Practical 10
Aim: To write a python program to remove all the lines that
contain the character “a‟ in a file and write it to another file.
Code:
Text file used:
Output:
Code:
Output :
Practical 12
Aim: Consider a binary file "student.dat" containing details
such as rollno, name and marks. Write a python program to
search for a given roll number in a binary file and update the
name.
Code:
Output :
Practical 13
Aim: Consider a binary file "student.dat" containing details
such as rollno, name and marks. Write a python program to
display details of those students who secured more than 70
marks.
Code:
Output :
Practical 14
Aim: To write a python program to create employee.csv file
and store empno, name and salary then search for a particular
empno to display name and salary.
Code:
Output :
Code:
Output:
1
SQL QUERIES
Write MySQL command to create a database SCHOOL.
3 Write MySQL command to create a table ‘student’ with the following attributes:
rollno, name, class, gender, dob and marks.
Set rollno as primary key.
7 Write MySQL command to display name and class of all male students.
8 Write MySQL command to display name and class of male students of class 12.
9 Write MySQL command to display total marks of students studying in class 12.
10 Write MySQL command to display records of student table in ascending order of their marks.
11 Write MySQL command to display name, class and marks of students of class 11 in descending
order of their marks.
12 Write MySQL command to display number of students in each class.
13 Write MySQL command to display average marks, minimum marks and maximum marks obtained
by student gender wise.
14 Write MySQL command to display name and marks of students whose name start with character
‘s’ .
15 Write MySQL command to display name and marks of students whose marks are between 70 and
80.
16 Write MySQL command to display name and class of students whose marks is NULL.
18 Write MySQL command to increase the marks of all student by 10 who born in year 2004.
19 Write MySQL command to remove the records of those students who scored less than 60 marks.
20 Write MySQL command to add a new column city with appropriate data type in student table.
SQL Connectivity Programs
1 Write python code to establish a connection between mySQLdb and Python.
2 Write python code to create table emp in school database and showing existing table names
3 Write python code to display records of table emp from school database