[go: up one dir, main page]

0% found this document useful (0 votes)
21 views16 pages

Pre - 0 24 - 25 Lab Manual Updated

Uploaded by

abhaykatre.cse23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views16 pages

Pre - 0 24 - 25 Lab Manual Updated

Uploaded by

abhaykatre.cse23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Python Programming Lab (N-SECCS401P)

S. B. JAIN INSTITUTE OF TECHNOLOGY,


MANAGEMENT & RESEARCH, NAGPUR.
Session 2024-25

LAB MANUAL
Python Programming Lab (N-SECCS401P)

Year: 2nd
Semester: IV

Name of Student:
Roll No.:
Semester/Year:
Academic Session:
Date of Performance:
Date of Submission:

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

Hardware and Software Requirement

Hardware Requirement
● Processor : Dual Core
● RAM : 1GB
● Hard Disk Drive : > 80 GB

Software Requirement
● Operating System – Windows 2007 and Ubuntu
● Package used – Python3, Numpy, Pandas, Django
● IDE – Visual Studio, Pycharm
● Editors – Text editor, sublime text
● Online platform – Jupyter, Google co-lab

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

Institute Vision:
Emerge as a leading Institute for developing competent and creative Professionals

Institute Mission:
1. Providing Quality Infrastructure and experienced faculty for academic excellence
2. Inculcating skills, knowledge and opportunities for competency and creativity
3. Aligning with Industries for knowledge sharing, research and development

Department Vision:
To become a center for quality education in the field of computer science & engineering and to
create competent professionals.

Department Mission:
● To provide academic ambience and latest software tools to prepare competent Software
Engineers with strong theoretical and practical knowledge.
● To foster professionalism and strong work ethics in students for the betterment of Society.
● To provide adequate infrastructure as well as experienced & skilled faculty members.
● To encourage the spirit of entrepreneurship and adaptability in our students in view of the ever-
changing scenario of the Software Industry.

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

Course Outcomes:
On successful completion of this course, students will be able to
1. Apply: Apply knowledge of Python Scripting, control structure, string and functions to
solve the given problems effectively.
2. Apply: Utilize concepts of NumPy, data structure, files and data frames to develop
efficient solution for the given problems.
3. Analysis: Analyze the problems using knowledge of object-oriented programming and
Exception handling to develop useful applications.
4. Evaluate: Select appropriate libraries and modules available in python programming to
solve the given problem efficiently.
5. Create: Design and Develop solutions using Python libraries and Web framework for
the given problem statement.

GENERAL INSTRUCTIONS FOR STUDENTS

DO’S
● Students should enter into the laboratory on time and should take permission before
entering laboratory.
● Students should come in proper uniforms.
● Students should come with Observation book and Lab manual in the laboratory.
● Students should maintain silence inside the laboratory.
● After completing the laboratory exercise, make sure to shut down the system and arrange
chairs properly.

DONT’S
● Students bringing the bags inside the laboratory.
● Students using mobile phones inside the laboratory.
● Students using the computers in an improper way.
● Students scribbling on the desk and mishandling the chairs.
● Students making noise inside the laboratory.

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

List of Practicals

Sr. Name of Practical CO


No.
1. PRE-LAB: Develop an application to print sum of two numbers entered from the CO1
keyboard in various python IDEs, editors and online platforms.
2. Virtual Lab: Develop an application to implement Built in Function in python. CO2
3. Develop a NumPy program to multiply a 5X3 matrix by a 3X2 matrix and create a CO1
product matrix, also print the product matrix. Take input data from user.
4. Design a function that accepts sequence of lines as input and prints the lines after CO1
making all characters in the sentence capitalized. Suppose the following input is CO4
supplied to the program:
Practice makes perfect

Then, the output should be:


PRACTICE MAKES PERFECT
5. A number from 0 to 1000 is produced by the system, design an application which can CO2
store these numbers into a list and then separate the odd & even numbers. These odd
CO4
and even numbers should be stored in separate lists named ODD_LIST &
EVEN_LIST respectively. Print these lists in reverse order. Convert these two
reversed lists into two tuples and print them.
6. Develop an application using file handling to write some text into a file called CO2
money.txt then transfer data from this file into a file called data.txt. Print the content
CO4
of the file data.txt.

Create class ‘University’ with attribute, university_name, accreditation. Create class


7. CO3
‘College’ which inherits ‘University’ and stores information such as college_name,
college_code. Create class ‘Student’ which inherits ‘College’ and store information CO4
such as name, enrollment_no , class, section, marks in subjects. calculate total marks
obtained and percentage. process and print result (total marks and percentage) of 10
students along with other details. If any subject mark is less than 40 then throw an
exception which prints ‘Sorry you are Fail’.
8. Develop an application which can read data from a given dataset. The dataset contains CO2
information regarding cars manufactured by various companies. Ensure your
CO4
application does following operations:
• Print the first and last five rows.
• Clean the dataset and update the CSV file
• Find the most expensive car company name
• Print All Toyota Cars details
• Count total cars per company

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

Develop a Python program to plot a line graph using Matplotlib. The graph should
9. display the relationship between two variables: CO4
X- axis: Number of study hours (e.g., [1, 2, 3, 4, 5]). CO5
Y-axis: Marks obtained in a test out of 100 (e.g., [20, 40, 60, 80, 100]).
1. Add a title to your graph (e.g., "Study Hours vs Marks").
2. Label the X-axis as "Hours Studied" and the Y-axis as "Marks".
3. Use a different line style, color, and marker to customize your plot.
4. Add a legend to describe the line (e.g., "Marks Trend").

OPEN ENDED ALL


10.
CO’s

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

S. B. JAIN INSTITUTE OF TECHNOLOGY,


MANAGEMENT & RESEARCH, NAGPUR.

Practical No. 0
Aim: PRE-LAB: Develop an application to print sum of two numbers
entered from the keyboard in various python IDEs, editors and online
platforms.

Name of Student:
Roll No.:
Semester/Year:
Academic Session:
Date of Performance:
Date of Submission:

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

AIM: PRE-LAB: Develop an application to print sum of two numbers entered from the keyboard
in various python IDEs, editors and online platforms.

OBJECTIVE/EXPECTED LEARNING OUTCOME:


● To be able to understand & run python programs in different editors.
● To be able to execute python programs in various IDEs.
● To get knowledge about python online platforms.

HARDWARE AND SOFTWARE REQUIREMENT:


Hardware Requirement
● Processor: Dual Core
● RAM: 1GB
● Hard Disk Drive: > 80 GB

Software Requirement
● Operating System – Windows 2007 and Ubuntu
● Package used – Python3, Numpy, Pandas, Django
● IDE – Visual Studio, Pycharm
● Editors – Text editor, sublime text
● Online platform – Jupyter, Google co-lab

THEORY:
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming
language. It was created by “Guido van Rossum” during 1985- 1990. Python source code is also
available under the GNU General Public License (GPL). Python is designed to be highly readable.
It uses English keywords frequently whereas other languages use punctuation, and it has fewer
syntactic constructions than other languages.

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

Why python?
Python is Interpreted − Python is processed at runtime by the interpreter. You do not need
to compile your program before executing it. This is similar to PERL and PHP.
Python is Interactive − You can actually sit at a Python prompt and interact with the
interpreter directly to write your programs.
Python is Object-Oriented − Python supports Object-Oriented style or technique of
programming that encapsulates code within objects.

Python is a Beginner's Language − Python is a great language for the beginner-level


programmers and supports the development of a wide range of applications from simple text
processing to WWW browsers to games.
Software quality − Python’s focus on readability, coherence, and software quality in general
sets it apart from other tools in the scripting world. Python code is designed to be readable, and
hence reusable and maintainable—much more so than traditional scripting languages.
Developer productivity − Python boosts developer productivity many times beyond
compiled or statically typed languages such as C, C++, and Java. Python code is typically one-
third to 3 one-fifth the size of equivalent C++ or Java code. That means there is less to type, less
to debug, and less to maintain after the fact. Python programs also run immediately, without the
lengthy compile and link steps required by some other tools, further boosting programmer speed.
Program portability − Most Python programs run unchanged on all major computer
platforms. Porting Python code between Linux and Windows, for example, is usually just a matter
of copying a script’s code between machines.
Support libraries − Python comes with a large collection of prebuilt and portable
functionality, known as the standard library. This library supports an array of application-level

programming tasks, from text pattern matching to network scripting. In addition, Python can be
extended with both homegrown libraries and a vast collection of third-party application support
software.
Component integration − Python scripts can easily communicate with other parts of an
application, using a variety of integration mechanisms. Such integrations allow Python to be used
as a product customization and extension tool.

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

Enjoyment − Because of Python’s ease of use and built-in toolset, it can make the act of
programming more pleasure than chore. Although this may be an intangible benefit, its effect on
productivity is an important asset.

Installing python:
● Open a Web browser and go to https://www.python.org/downloads/.
● Follow the link for the Windows installer python-XYZ.msi file where XYZ is the version
you need to install.
● To use this installer python-XYZ.msi, the Windows system must support Microsoft Installer
2.0. Save the installer file to your local machine and then run it to find out if your machine
supports MSI.
● Run the downloaded file. This brings up the Python install wizard, which is really easy to
use. Just accept the default settings, wait until the install is finished, and you are done.

IDEs, Editors & online platform for Python:


An IDE, or Integrated Development Environment, enables programmers to consolidate the
different aspects of writing a computer program.IDEs increase programmer productivity by
combining common activities of writing software into a single application: editing source code,
building executables, and debugging.

Following IDEs/Editors/Online platform can be used for python programming:

IDLE, PyCharm, Spyder, Jupyter, VS Code, PyDev, Eclipse, Netbeans, Cloud9, PyScriptor,
Sublime Text3, Notepad++, Atom, Thonny, Wing, Eric, IntelliJ IDEA, Google Co-lab.

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

ALGORITHM:

FLOWCHART:

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

CODE:

Steps to Run Program in Text Editor:

Steps to Run Program in VS Code:

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

Steps to Run Program in Google Co-lab:

Steps to Run Program in Jupyter:

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

INPUT & OUTPUT:

CONCLUSION:

DISCUSSION AND VIVA VOCE:


Q. 1) What is Python?
Q. 2) What are the benefits of using Python
Q. 3) What is an Interpreted language?
Q. 4) What is your understanding of Python?
Q. 5) Name some of the features of Python.

REFERENCE:
1. https://python-iitk.vlabs.ac.in/
2. “Learning Python”, Mark Lutz, Fourth Edition, O'Reilly Media, Inc.
3. https://colab.research.google.com/?utm_source=scs-index
4. https://www.youtube.com/watch?v=Y8Tko2YC5hA

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

SCREENSHOT:

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur


Python Programming Lab (N-SECCS401P)

Department of Computer Science & Engineering, S.B.J.I.T.M.R., Nagpur

You might also like