COMPUTER SCIENCE
PRACTICAL EXERCISES
CLASS – XII
EX.NO:
DATE:
CREATING A MENU DRIVEN PROGRAM TO PERFORM 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:
Run – 1:
RUN- 2
***************************************************************************************
EX.NO:
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:
RUN -1:
RUN -2 :
*****************************************************************************************
EX.NO:
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:
RUN -1:
RUN – 2:
**************************************************************************************
EX.NO:
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:
**************************************************************************************
EX.NO:
DATE:
CREATING A PYTHON PROGRAM TO GENERATE RANDOM 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:
**************************************************************************************
EX.NO:
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:
DATE:
CREATING A PYTHON PROGRAM TO INTEGRATE 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:
EX.NO:
DATE:
CREATING A PYTHON PROGRAM TO INTEGRATE 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:
RUN -1:
Run – 2:
EX.NO:
DATE:
CREATING A PYTHON 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:
RUN -1:
Run -2: