Python - Lab 3
Python - Lab 3
List of Experiments
Laboratory 3
Title of the Laboratory Exercise: Input Output operations
1. Introduction and Purpose of Experiment
Python provides the Input-Output facilityto interact with the user. Some of the functions
such asinput() and print() are widely used for standard input and output operations
respectively. By solving the problems, students will be able to develop programs to read
input from screen and display output to the screen.
3. Experimental Procedure
i. Analyse the problem statement
ii. Design an algorithm for the given problem statement and develop a
flowchart/pseudo-code
iii. Implement the algorithm in Python language
iv. Execute the Python program
v. Test the implemented program
vi. Document the Results
vii. Analyse and discuss the outcomes of the experiment
4. Questions
a. Write a Python program to accept three numbers from the user (in a single line
separated by spaces) and display their average.
b. Write a Python program to display the calendar of the given month and year.
c. Write a Python program to accept two complex numbers from the user and display
their sum, difference and product.
d. Write a Python program to enter an integer number and perform the following
operations (use built in methods) on the integer
Square, Cube, and Factorial
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
5.Calculations/Computations/Algorithms
FLOWCHARTS
4)a.
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
4)b.
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
4)c.
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
4)d.
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
6. Presentation of Results
PROGRAM 4)a.
OUTPUT 4)a.
ANALYSIS : HERE WE TAKE 3 NUMBERS AS INPUTS AND WE PRODUCE THE AVERAGE OF THE
THREE NUMBERS.
PROGRAM 4)b.
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
OUTPUT
4)b.
ANALYSIS :
HERE WE
TAKE INPUT AS THE M AS MONTH AND Y AS YEAR AND GIVE THE CALENDER FOR THAT
MONTH AND YEAR.
PROGRAM 4)c.
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
OUTPUT 4)c.
ANALYSIS : HERE WE TAKE THE INPUTS AS A AS REAL PART AND B AS IMAGINARY PART OF
THE COMPLEX NUMBER AND HENCE FIND THE SUM , DIFFERENCE AND PRODUCT OF THE
COMPLEX NUMBERS.
PROGRAM 4)d.
OUTPUT
4)d.
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
ANALYSIS : HERE WE TAKE A NUMBER FROM THE USER AND FIND THE SQUARE , CUBE AND
FACTORIAL OF THAT NUMBER.
7.Conclusions
WE HAVE EXECUTED 4 PROGRAMS IN WHICH THE FIRST PROGRAM IS USED
TO CALCULATE THE AVERAGE OF THREE NUMBERS USING 3 VARIABLES SUCH AS
A,B,C.
IN THE SECOND PROGRAM WE HAVE PRODUCED A CALENDER USING USER INPUTS
SUCH AS
M AND Y. IN THE THIRD PROGRAM WE HAVE FOUND THE SUM , DIFFERENCE AND
PRODUCT
OF THE COMPLEX NUMBER USING THE USER INPUTTED REAL AND IMAGINARY
PARTS .
IN THE FOURTH PROGRAM WE HAVE FOUND THE SQUARE , CUBE AND ALSO
FACTORIAL OF
USER INPUTTED NUMBER.