0% found this document useful (0 votes)
89 views38 pages

Vivek Practical File

The document outlines various programming tasks that involve creating functions to perform operations such as finding sums, averages, volumes, and handling file operations including reading, writing, and manipulating text and binary files. Each program is designed to demonstrate different functionalities, including default parameters, user input, and file handling techniques. The document serves as a guide for implementing these programming exercises.

Uploaded by

khatrisavita1981
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views38 pages

Vivek Practical File

The document outlines various programming tasks that involve creating functions to perform operations such as finding sums, averages, volumes, and handling file operations including reading, writing, and manipulating text and binary files. Each program is designed to demonstrate different functionalities, including default parameters, user input, and file handling techniques. The document serves as a guide for implementing these programming exercises.

Uploaded by

khatrisavita1981
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Functions

Program-1:
WAP using functions to find the sum of two numbers
which is
1)Default values given:

OUTPUT:
2)Taken from user:

Output:
Program 3:
WAP using function to find average marks from user

OUTPUT:
Program 4:
#WAP to invoke a function that takes a number as an
argument and return the cube of the number. If there
is no argument passed then it should return cube of 2

OUTPUT:
Program 5:
WAP to calculate volume of box with appropriate default parameters.
Your function should have length height and breadth

OUTPUT:
Program 6:
WAP to get multiplication of given default values:

Output:
Program 7:
WAP to find the DA calculated, Tax calculated, and Pat
after tax when basic salary is given of user:

Output:
Program 8:
WAP to separate the sum and differentiation of either
two given values or by User with the help of “#”:

OUTPUT:
Program 9:
WAP to count the no. of Tigers by using Global
function:

Output:

Program 10:
WAP to separate two different variables by “#” and
“@”:

Output:

Program 11:
WAP to Enter a number whose table you want to
calculate:

Output:

Program 12:
WAP to calculate the total price of a car after adding all
the taxes:

Output:

Program 13:
WAP to enter the avg. marks of a student:

Output:
File Handling
Text File

Program 1:
Create TEXT FILE text1, input data from user about
introduction:

OUTPUT:

Program 2:
To read the text file created.

OUTPUT:
Program 3:
#Count no. of word in file:

OUTPUT:

No. of elements are 1 because there is no “&” in the


list.
Program 4:
Count and Search the no. of “to” and “the” in the text
file:

Output:

Program 5:
Make a text file named book.dat.

Output

Program 6:
To append the text file:

Output:

Program 7:
To read a text file by readline:

Output:
Binary File

Program 1:
Create a binary file to write the student records, by the
name of “Student.dat”.

Output:

Program 2:
Read a binary file:

Output:
Program 3:
Find the no. of students having marks >=75.

Output:
Program 4:
To search the name of the student:

Output:

Program 5:
Delete a record from the binary file:
Output:

Program 6:
Update a new record in “Student.dat”.
Output:
CSV File

Program 1:
Write a record with student roll no, Name and marks
in the csv file using writerow( ) function:

Output:

Program 2:
Reading from the csv file:

You might also like