EX.
NO:
1 DATE:
CREATING A MENU DRIVEN PROGRAM TOPERFORM ARITHMETIC
OPERATIONS
AIM
:
To write a menu driven Python Program to perform Arithmetic operations (+,-
*, /)
based on the user’s choice.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Program Executed
Output: Run – 1:
RUN- 2
***************************************************************************************
EX.NO:
2 DATE:
CREATING A PYTHON PROGRAM TO DISPLAY FIBONACCI SERIES
AIM:
To write a Python Program to display Fibonacci Series up to ‘n’ numbers.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Program Output:
RUN -1:
RUN -2 :
*****************************************************************************************
EX.NO:
3 DATE:
CREATING A PYTHON PROGRAM TO IMPLEMENT STRING OPERATIONS
AIM
:
To write a menu driven program in Python using user defined functions
to take string as input and
(i) To Check whether the given string is palindrome or not.
(ii) To count number of occurrences of a given character.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Program Output:
RUN -1:
RUN-2:
***************************************************************************************
EX.NO:
4 DATE:
CREATING A MENU DRIVEN PROGRAM TO FIND FACTORIAL AND SUM OF LIST
OF
NUMBERS USING FUNCTION.
AIM
:
To write a menu driven Python Program to find Factorial and sum of list of
numbers using function.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Program
Output: RUN -1:
RUN – 2:
**************************************************************************************
EX.NO:
5 DATE:
CREATING A PYTHON PROGRAM TO IMPLEMENT MATHEMATICAL
FUNCTIONS
AIM:
To write a Python program to implement python mathematical functions
to find:
(i) To find Square of a Number.
(ii) To find Log of a Number(i.e. Log10)
(iii) To find Quad of a Number
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Program Output:
**************************************************************************************
EX.NO:
6 DATE:
CREATINGAPYTHONPROGRAMTO GENERATERANDOM NUMBER
BETWEEN 1 TO 6
AIM
:
To write a Python program to generate random number between 1 to 6
to simulate the dice.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Output Program:
**************************************************************************************
EX.NO:
7 DATE:
CREATING A PYTHON PROGRAM TO MAKE USER DEFINE MODULE AND
IMPORT SAME IN ANOTHER MODULE OR PROGRAM.
AIM
:
To write a Python Program to create user defined modules Area_Square
and Area_Rectangle and import them in another module or program.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Program Output(Area.py):
Run – 1:
Run – 2:
***********************************************************************************
EX.NO:
8 DATE:
CREATING A PYTHON PROGRAM TO READ A TEXT FILE LINE BY LINE
AND DISPLAY EACH WORD SEPARATED BY '#'
AIM
:
To write a Python Program to Read a text file "Story.txt" line by line and
display each word separated by '#'.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Story.txt:
***************************************************************************************
EX.NO:
9 DATE:
CREATING A PYTHON PROGRAM TO READ A TEXT FILE AND DISPLAY
THE NUMBER OF VOWELS/CONSONANTS/LOWER CASE/ UPPER CASE
CHARACTERS.
AIM:
To write a Python Program to read a text file "Story.txt" and displays the
number of Vowels/ Consonants/ Lowercase / Uppercase/characters in the
file.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Story.txt:
***************************************************************************************
EX.NO:1
0 DATE:
CREATING A PYTHON PROGRAM TO COPY PARTICULAR LINES OF A TEXT
FILE INTO AN ANOTHER TEXT FILE
AIM:
To write a python program to read lines from a text file "Sample.txt" and copy
those lines into another file which are starting with an alphabet 'a' or 'A'.
SOURCE CODE:
Result:
Thus the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Program
output: Sample.txt:
Python Executed Program Output:
New.txt:
*****************************************************************************************
EX.NO:
11
DATE:
CREATING A PYTHON PROGRAM TO CREATE AND SEARCH RECORDS
IN BINARY FILE
AIM
:
To write a Python Program to Create a binary file with roll number and
name. Search for a given roll number and display the name, if not found
display appropriate message.
SOURCE CODE:
Result:
Thus , the above Python program is executed successfully and the output is
verified.
SAMPLE OUPUT:
PYTHON PROGRAM EXECUTED OUTPUT:
************************************************************************************
EX.NO:
12 DATE:
CREATING A PYTHON PROGRAM TO CREATE AND UPDATE/MODIFY
RECORDS IN BINARY FILE
AIM
:
To write a Python Program to Create a binary file with roll number,
name, mark and update/modify the mark for a given roll number.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output
is verified.
SAMPLE OUTPUT:
PYTHON PROGRAM EXECUTED OUTPUT:
**********************************************************************************
EX.NO:
13 DATE:
CREATING A PYTHON PROGRAM TO CREATE AND SEARCH EMPLOYEE’S
RECORD IN CSV FILE.
AIM
:
To write a Python program Create a CSV file to store Empno, Name,
Salary and search any Empno and display Name, Salary and if not found
display appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
PYTHON PROGRAM EXECUTED OUTPUT:
******************************************************************************
EX.NO:
14 DATE:
CREATING A PYTHON PROGRAM TO PERFORM READ AND WRITE
OPERATION WITH CSV FILE
AIM
:
To write a Python program Create a CSV file to store Rollno, Name, marks
and read the content from csv file.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output
is verified.
SAMPLE OUTPUT:
PYTHON PROGRAM EXECUTED OUTPUT:
*************************************************************************************
*******
EX.NO:
15 DATE:
CREATING A PYTHON PROGRAM TO IMPLEMENT STACK OPERATIONS
AIM
:
To write a Python program to implement Stack using a list data-structure.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output
is verified.
SAMPLE OUTPUT:
Python Program Executed Output:
****************************************************************************************
EX.NO:1
6 DATE:
CREATING APYTHON PROGRAM TOINTEGRATE MYSQL WITH PYTHON
(INSERTING RECORDS AND DISPLAYING RECORDS)
AIM
:
To write a Python Program to integrate MYSQL with Python by inserting
records to Emp table and display the records.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Program Output:
SQL OUTPUT:
EX.NO:
17 DATE:
CREATING APYTHON PROGRAM TOINTEGRATE MYSQL WITH PYTHON
(SEARCHING AND DISPLAYING RECORDS)
AIM:
To write a Python Program to integrate MYSQL with Python to search an
Employee using EMPID and display the record if present in already
existing table EMP, if not display the appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Program
Output: RUN -1:
Run – 2:
SQL OUTPUT:
OUTPUT -1:
OUTPUT -2:
EX.NO:
18 DATE:
CREATING APYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON
(UPDATING RECORDS)
AIM:
To write a Python Program to integrate MYSQL with Python to search an
Employee using EMPID and update the Salary of an employee if present
in already existing table EMP, if not display the appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output
is verified.
SAMPLE OUTPUT:
Python Executed Program
Output: RUN -1:
Run -2:
SQL OUTPUT:
EX.NO:
19 DATE:
CREATING APYTHON PROGRAM TOINTEGRATE MYSQL WITHPYTHON
(DELETING RECORDS)
AIM
:
To write a Python Program to integrate MYSQL with Python to search an
Employee using EMPID and delete the record of an employee if present
in already existing table EMP, if not display the appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is
verified.
SAMPLE OUTPUT:
Python Executed Program
Output: RUN -1:
RUN – 2:
SQL OUTPUT: