Practical File 2023-24
Practical File 2023-24
Source Code:
Program 2:Write a Python Program to display Fibonacci Series upto ‘n’ numbers
Source Code:
Program 3: Write a Python Program to check whether the inputted number is Perfect
number or not
Source Code:
Program 4: Write a Python program to check whether the given number is armstrong
number or not
Source Code:
Program 5: Write a python program to input any two
tuples and swap their values.
Source code:
Program 6: Write a python program to generate random numbers
between 1 to 6 to stimulate the dice.
Source code:
Program 7: create a program using user defined function named
login that accepts userid and password as parameters
(login(uid,pswd))that displays a message account blocked in case of
three wrong attempts. The login is successful if the user enters user
ID as "ADMIN" and password as"Rims123". On successful login,
display a message login successful.
Source code:
Output 1:
Output 2:
Program 8) Read text file line by line and display each word separated by ‘#’
THE#SECRET#OF#YOUR#FUTURE#IS#HIDDEN#IN#YOUR#DAILY#ROUTINE.#
IF#YOU#ARE#NOT#WILLING#TO#LEARN,#NO#ONE#CAN#HELP#YOU.#
IF#YOU#ARE#DETERMINED#TO#LEARN,#NO#ONE#CAN#STOP#YOU.#
Program 9:Read a text file and display the number of vowels/ consonants/ uppercase/
lowercase characters in the file
Note: Content of myfile.txt
12 Computer Science
Varam Kadavu
Varam PO
kannur
KERALA 670594
Output:
vowels= 19
Consonants = 26
Uppercase= 13
Lowercase= 32
Program 10: Remove all the lines that contain the character ‘a’ in a file and write it to another
files
Note: Content of SampleOld.txt:
Start…
First Line
Second Line
Second Last Line
End..
Source Code:
Output
Changed content of SampleOld.txt is:
First Line
Second Line
End..
1. Add record
2. Display records
3. Search record
4. Exit
Source code
Program 14: Write a menu based program to Maintaining Book details like bcode, btitle
and price using stacks in python.
Source Code