Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
Computer Programming Laboratory
B. Tech. 1st Semester
Name : SALIN CHAUDHARY
Roll Number : 21ETCS002173
Department :Computer Science and Engineering
Faculty of Engineering & Technology
Ramaiah University of Applied Sciences
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
Ramaiah University of Applied Sciences
Private University Established in Karnataka State by Act No. 15 of 2013
Faculty Engineering & Technology
Programme B. Tech. in Computer Science and Engineering
Year/Semester 1st Year /1st Semester
Name of the Laboratory Computer Programming Laboratory
Laboratory Code 21CSS106A
List of Experiments
1. Introduction to Python programming environment
2. Variables, data types, operators and expressions
3. Input output operations
4. Logic operations and decision making
5. Loop statements
6. Character and string operations
7. Functions
8. File handling
9. Data structures
10. Libraries
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
Laboratory 5
Title of the Laboratory Exercise: Loop statements
1. Introduction and Purpose of Experiment
Loop statements are used to repeat a statement or set of statements multiple times. By
solving the problems students will be able to apply iterative control statements to control
the program execution.
2. Aim and Objectives
Aim
To develop programs involving loops using appropriate control statements in Python
Objectives
At the end of this lab, the student will be able to
Apply loop control statements such as for and while to repeat a block of code
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 an integer number and find sum of digits in the
number.
b. Write a Python program to check whether the given number is perfect number or
not.
c. Write a program to perform addition and subtraction of two matrices
i. Without using numpy module
ii. Using numpy module
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)i.
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
4)c)ii.
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
6. Presentation of Results
PROGRAM
4)a.
OUTPUT
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
PROGRAM
4)b.
OUTPUT
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
PROGRAM
4)c)i.
OUTPUT
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
PROGRAM
4)c)ii.
OUTPUT
Name: SALIN CHAUDHARY Registration Number: 21ETCS002173
7. Conclusions
HERE IN THE FIRST PROGRAM WE LEARNT HOW TO FIND SUM OF DIGITS OF A GIVEN
NUMBER. IN THE SECOND PROGRAM WE LEARNT HOW TO FIND WHETHER A NO IS A
PERFECT NUMBER OR NOT. IN THE THIRD PROGRAM WE GOT TO KNOW HOW TO ADD AND
SUBTRACT MATRICES BY USING AND ALSO NOT USING THE NUMPY MODULE.