Practical 2024
Practical 2024
OUTPUT:-
Q2 Write a Python program to find the factorial of a
number using default parameters. (Include proper
error condition for a negative number as input.)
OUTPUT:-
Q3 Write a program to demonstrate the concept of the
scope of a variable.
OUTPUT:-
Q4 . Write a program to create a function menu()
which passes List as an argument and displays the
following menu and does the operation accordingly.
1. Count and print ARMSTRONG numbers.
2. Count and print Prime Numbers
3. Exit
OUTPUT:-
Q5 Write a function insert(L,num,pos) that accepts a
list,a number and a position where number is to be
added and then add the number in the list.Use try and
except to check that position is valid otherwise display
error message.
OUTPUT:-
Q6 Read a text file line by line and display each word
separated by a #.
OUTPUT:-
Q7 Read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in
the file
OUTPUT:-
Q8 Remove all the lines that contain the character 'a'
in a file and write it to another file
Output:-
Q9 Create a binary file with roll number, name and
marks. Input a roll number and update the marks.
Output:-
Q10Write a random number generator that generates
random numbers between 1 and 6 (simulates a dice).
OUTPUT:-
Q11 Write a Python program to implement a stack
using list.
OUTPUT:-
Q12 Create a CSV file by entering user-id and
password, read and search the password for given user
id.
OUTPUT:-