Professional Documents
Culture Documents
Practical XII A Nikunj
Practical XII A Nikunj
Q1. WAF to find the sum of the first and last element of a list, the function
takes as argument a list of integers.
SOURCE CODE
OUTPUT
Q2. WAF that takes an integer as an argument and returns its factorial. Call this
function to calculate n! /r!*(n-r)! .
SOURCE CODE
OUTPUT
Q3. WAF that takes string as argument and prints the no. of uppercase,
lowercase, digits and spaces in it.
SOURCE CODE
OUTPUT
Q4. WAF that takes a dictionary object as argument and
searches for a particular value in it.
SOURCE CODE
OUTPUT
Q5. WAF function to create a file and put some text to it. Write another function that
reads this file and print the file contents in reverse.
SOURCE CODE
OUTPUT
Q6. WAF function to create a file and enter some lines in it. Write another function to
return the size of file in bytes.
SOURCE CODE
OUTPUT
Q7. WAF to create a file and enter some lines in it. Write another function to return
the number of words in the file.
SOURCE CODE
OUTPUT
Q8. WAF to create a file and enter some lines in it. Write another function to return
the number of lines that begin with a vowel.
SOURCE CODE
OUTPUT
Q9. WAF to create a file and enter some lines in it. Write another function print each
line in reverse.
SOURCE CODE
OUTPUT
Q10. WAF to create a file and enter some lines in it. Write another function to print
the number of words in each line.
SOURCE CODE
OUTPUT
Q11. WAF and enter student records [rno,name,age] in a data file. WAF to search for
a particular roll number in the file.
SOURCE CODE
OUTPUT
Q12. WAF and enter student records [rno,name,age] in a data file. WAF to display all
the records entered in the file.
SOURCE CODE
OUTPUT
Q13. WAF and enter student records [rno,name,age] in a data file. WAF to search for
a rno and modify his age.
SOURCE CODE
OUTPUT
Q14. WAF and enter student records [rno,name,age] in a data file. WAF to search for
a rno and Delete it.
SOURCE CODE
OUTPUT
Q15. WAF to read a CSV file containing student records and count the number of
records in it.
SOURCE CODE
OUTPUT
Q16. WAF to write records of emp[ empno,ename,age] to a csv file.
SOURCE CODE
OUTPUT