Practical File_CS
Practical File_CS
Date:
SNo. Practical Date Signature
Working with functions
1 Write a python program using a function to print factorial
number series from n to m numbers.
2 Write a python program to accept the username "Admin" as the
default argument and password 123 entered by the user to allow
login into the system.
3 Write a python program to demonstrate the concept of variable
length argument to calculate the product and power of the first
10 numbers.
4 Write a program using a function to find whether the given
number is palindrome or not.
5. Write a program using a function to print a Fibonacci series.
Data File handling
6 Create a text file "intro.txt" in python and ask the user to write a
single line of text by user input.
7 Write a program to count a total number of lines and count the
total number of lines starting with 'A', 'B', and 'C' from the file
dfh.txt.
8 Write a program to replace all spaces from text with - (dash) from
the file intro.txt.
9 Write a program to know the cursor position and print the text
according to the below-given specifications:
Print the initial position
Move the cursor to 4th position
Display next 5 characters
Move the cursor to the next 10 characters
Print the current cursor position
Print next 10 characters from the current cursor position
10 Write a program to store customer data into a binary file cust.dat
14 Read a CSV file top5.csv and print them with tab delimiter.
Ignore first row header to print in tabular form.
15 Read a CSV file students.csv and print them with tab delimiter.
Ignore first row header to print in tabular form.
Field 1 Data Type
StudentID Integer
StudentName String
Score Integer
16 Write a program to read byte by byte from a file using seek() and
tell().
17 Write a program to read and write operations on to a student.csv
file having fields roll number, name, stream and marks.
18 Write a menu driven program to calculate area of different
shapes using functions.
19 Write a menu driven program to perform basic arithmetic
calculations using functions.
20 Write a menu driven to perform basic operations on text file
21 Write a menu driven program in python which contain student
details in binary file and should have following facilities:
1. Writing student details.
2. Display all students’ details
3. Search particular student details
4. Update any student details
5. Delete any student details
6. Exit
22 Write a menu driven to perform basic operations on CSV file
23 Write a program to create a stack called country and to perform
the basic operations on it
24 Write a program to create a stack called employee and to perform
the basic operations on it
25 Write a program to generate random number between 1 to 6
26 Write a program to handle multiple exceptions
1 Write a python program using a function to print factorial number series
from n to m numbers.
OUTPUT:
2 Write a python program to accept the username "Admin" as the default
argument and password 123 entered by the user to allow login into the
system.
OUTPUT:
3 Write a python program to demonstrate the concept of variable length
argument to calculate the product and power of the first 10 numbers.
OUTPUT:
4 Write a program using a function to find whether the given number is
palindrome or not.
OUTPUT:
5. Write a program using a function to print a Fibonacci series.
OUTPUT:
6 Create a text file "intro.txt" in python and ask the user to write a single line
of text by user input.
OUTPUT:
7 Write a program to count a total number of lines and count the total number
of lines starting with 'A', 'B', and 'C' from the file dfh.txt.
OUTPUT:
8 Write a program to replace all spaces from text with - (dash) from the file intro.txt.
OUTPUT:
9 Write a program to know the cursor position and print the text according to the
below-given specifications:
Print the initial position
Move the cursor to 4th position
Display next 5 characters
Move the cursor to the next 10 characters
Print the current cursor position
Print next 10 characters from the current cursor position
OUTPUT:
10 Write a program to store customer data into a binary file cust.dat using a dictionary
and print them on screen after reading them. The customer data contains ID as
OUTPUT:
11 Write a program to update a record from student.dat file by its rollno. Display the
updated record on screen.
OUTPUT:
12 Write a program to write data into binary file marks.dat and display the records of
students who scored more than 95 marks.
OUTPUT:
13 Read a CSV file top5.csv and print the contents in a proper format. The data for
top5.csv file are as following:
SNo Batsman Team Runs Highest
OUTPUT:
14 Read a CSV file top5.csv and print them with tab delimiter. Ignore first row header
to print in tabular form.
OUTPUT:
15 Read a CSV file students.csv and print them with tab delimiter. Ignore first row
header to print in tabular form.
Field 1 Data Type
StudentID Integer
StudentName String
Score Integer
OUTPUT:
16 Write a program to read byte by byte from a file using seek() and tell().
OUTPUT:
17 Write a program to read and write operations on to a student.csv file having fields
roll number, name, stream and marks.
OUTPUT:
18 Write a menu driven program to calculate area of different shapes using functions.
OUTPUT:
19 Write a menu driven program to perform basic arithmetic calculations using
functions.
OUTPUT:
20 Write a menu driven to perform basic operations on text file
OUTPUT:
21 Write a menu driven program in python which contain student details in binary
file and should have following facilities:
1. Writing student details.
2. Display all students’ details
3. Search particular student details
4. Update any student details
5. Delete any student details
6. Exit
OUTPUT:
22 Write a menu driven to perform basic operations on CSV file
OUTPUT:
23 Write a program to create a stack called country and to perform the basic
operations on it
OUTPUT:
24 Write a program to create a stack called employee and to perform the basic
operations on it
OUTPUT:
25 Write a program to generate random number between 1 to 6
OUTPUT:
26 Write a program to handle multiple exceptions
OUTPUT: