You are on page 1of 14

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
Ramaiah of Applied
University Sciences
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
Name: SALIN CHAUDHARY Registration Number:21ETCS002173

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 4
Title of the Laboratory Exercise: Logic operations and decision making
1. Introduction and Purpose of Experiment
Python provides number of control flow instructions/statements to control the flow of
program execution conditionally. By solving the problems, students will be able to apply
conditional control statements to control the program execution.

2. Aim and Objectives


Aim
 To develop programs involving branching using appropriate control statements in
Python
Objectives
At the end of this lab, the student will be able to
 Apply conditional control statements such as if-else and nested if-else to express
decisions
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 check whether the given number is zero, positive or
negative.
b. Write a Python program to check whether the given year is leap year or not.
c. Write a Python program to display the roots of a quadratic equation.
d. Write a Python program to perform arithmetic operations.
(provide option to the user for entering numbers and his/her choice )
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.
Name: SALIN CHAUDHARY Registration Number:21ETCS002173

ANALYSIS: HERE WE FIND WHETHER THE NUMBER IS +,- OR IS ZERO USING VARIABLE X.

PROGRAM 4)b.

OUTPUT 4)b.

ANALYSIS: HERE WE CHECK WHETHER THE GIVEN YEAR IS A LEAP YEAR OR NOT .
Name: SALIN CHAUDHARY Registration Number:21ETCS002173

PROGRAM 4)c.

OUTPUT 4)c.
Name: SALIN CHAUDHARY Registration Number:21ETCS002173

ANALYSIS : HERE WE FIND THE ROOTS OF THE QUADRATIC EQUATION AND ALSO SPECIFY WHETHER
THE ROOTS ARE REAL ,IMAGINERY OR DISTINCT.
Name: SALIN CHAUDHARY Registration Number:21ETCS002173

PROBLEM 4)d.

OUTPUT 4)d.
Name: SALIN CHAUDHARY Registration Number:21ETCS002173

ANALYSIS : HERE WE TAKE 2 NUMBERS AS OUR INPUTS AND WE PROVIDE USER WITH THE 4
OPTIONS OF THE OPERATORS TO CHOOSE FROM AND PERFORM RESPECTIVE ATHEMATIC
OPERATIONS .
Name: SALIN CHAUDHARY Registration Number:21ETCS002173

7. Conclusions
HERE WE EXECUTED AND GOT OUTPUTS FOR FOUR PROGRAMS . THE FIRST
PROGRAM FINDS WHETHER A NUMBER GIVEN IS A POSITIVE NUMBER , A NEGATIVE
NUMBER OR IT IS ZERO. THE SECOND PROGRAM CHECKS WHETHER THE YEAR IS A
LEAP YEAR OR NOT .THE THIRD PROGRAM GIVES OR PROVIDES US THE ROOTS OF A
QUADRATIC EQUATION AND ALSO SPECIFIES WHICH TYPE OF ROOT IS IT WHETHER
IT REAL , IMAGINARY OR COMPLEX,ETC. THE FOURTH PROGRAM TAKES 2 INPUTS
FROM THE USER THEN PROVIDES THE USER WITH FOUR OPERATORS TO PERFORM
THE ARITHMETIC CALCULATION .

You might also like