17) Write a Program to integrate SQL with Python by importing the MySQL module and create a
record of employee and display the record.
SOURCE CODE:
OUTPUT:
18) Write a Program to integrate SQL with Python by importing the MYSQL module to search an employee
number in table employee and display record, if employee not found display appropriate message.
REFERENCE TABLE:
SOURCE CODE:
OUTPUT:
19) Write a Program to integrate SQL with Python by importing the MYSQL module to delete the record of
entered Student rollno
REFERENCE TABLE:
SOURCE CODE:
OUTPUT:
20) Write a Program to integrate SQL with Python by importing the MYSQL module to update the employee
record of entered eno.
REFERENCE TABLE:
SOURCE CODE:
OUTPUT:
6) Write a Python program to read a text file line by line and display each word separated by a ‘#’
TEXT FILE: ([Link])
SOURCE CODE:
OUTPUT:
7) Write a python program to read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file
TEXT FILE: ([Link])
SOURCE CODE:
OUTPUT:
11) Write a python program to create a binary file with name and roll number and perform search based
on roll number. If not found, display an appropriate message.
SOURCE CODE:
OUTPUT:
12) Write a python program to create a binary file with roll number, name and marks and update the marks
using their roll numbers
SOURCE CODE:
OUTPUT:
9) Write a Python program to remove all the lines that contain the character ‘a’ in a file and write it to another
file.
TEXT FILE: ([Link])
Source code:
Output:
14) Write a Python program to implement a stack using a list data-structure.
SOURCE CODE:
OUTPUT:
10) Write a Python program to create a CSV file with name and roll number and perform search for a
given roll number and display the name. If not found, display an appropriate message.
OUTPUT:
2) Write a Program to find the sum of elements of list recursively.
SOURCE CODE:
OUTPUT:
1) Write a program using function to compute the nth Fibonacci number.
SOURCE CODE:
OUTPUT:
8) Write a Program to search any word in given string/sentence
SOURCE CODE:
OUTPUT:
13) Write a program to take 10 sample phishing email, and find the most common word occurring
SOURCE CODE:
OUTPUT:
5) Write a program to find the factorial of a given number:
Source Code:
Output:
3) Write a python program to generate a random number between 1 and 6 (simulates a dice) Source
Code:
Output:
4) Write a python program to find whether the given number is prime or not.
Source Code:
Output:
16) Write a python program to implement stack using a list data-structure to perform the following operations:
i) To Push an object containing Doc-ID and Doc_name of doctors who are specialized
as “ENT” to the stack.
ii) To Pop the objects from the stack and display them.
iii) To display the elements of the stack (after performing Push and Pop)
Source Code:
Output:
15) Write a program, with separate user-defined functions to perform the following operations:
(i) To Create a function Push(Stk,D) Where Stack is an empty list and D is Dictionary of Items.
from this Dictionary Push the keys (name of the student) into a stack, where the
corresponding value (marks) is greater than 70.
(ii) To Create a Function Pop(Stk) , where Stk is a Stack implemented by a list of student names.
The function returns the items deleted from the stack.
(iii) To display the elements of the stack (after performing PUSH or POP).
Source Code:
Output: