12cs Practical2024
12cs Practical2024
Python programs
1 Write a Program to enter two numbers and print the arithmetic operations like
+,-,*,/, // and %. Using functions.
2 Write a program to find whether an inputted number is perfect or not.
5 Write a program to print appropriate weeks from entered number and display
error(exception handling)
def weeks_compute(days):
6 Write a program to read and display file content (myfile.txt)line by line with
each word separated by “#”
Note:Myfile.txt content is given below:
India has a unique culture and is one of the oldest and greatest civilizations
of the world. India has achieved all-round socio-economic progress since its
Independence
7 Program to read the content of file and display the total number of consonants,
uppercase, vowels and lower case characters.
Note:Demo.txt content is given below:
A microcomputer is a small computer built around
a microprocessor integrated circuit
8 Write a program to create a binary file to store “Rollno” and “Name”,search any
Rollno and display name if roll no found otherwise print message “record is not
found”.
9 Write a program to create a binary file”student.dat” to store “Rollno”, “Name”
and “Marks”.it should update marks of entered “Rollno”.
10 Write a program to know the cursor position on a text file and print the text
according to the given specifications:
a)print the initial position
b)move the cursor to 4th position
c)display the next 5 character
d)move cursor to next 10 characters
e)print the current cursor position
f)print the next 10 characters from current position
Note:Demo2.txt file content is given below:
Artificial intelligence is the simulation of human intelligence processes by
machines, especially computer systems. Examples of AI applications include
expert systems, natural language processing (NLP), speech recognition and
machine vision.
11 Create a binary file client.dat to hold records like client_Id,Client_ name and
address using dictionary.write functions to write data,read them and print the
screen.
12 Write a program to write data into a binary file marks.dat and display the records
of students who scored more than 95 marks.
13 Write a program to read a csv file Top.csv and print the contents with tab
delimiter.ignore first row header to print in tabular form.the data for Top.csv are
as following:
Top.csv
Sr.No Batsman Team Runs Highest
1 K L Rahul KXI 670 132*
2 S Dhawan DC 618 106*
3 Dawid SRH 548 85*
Warner
4 Shreyash DC 519 88*
iyer
5 Ishan kishan MI 516 99
14 Write a menu –driven python program to impement stack operation.
Sql queries