0% found this document useful (0 votes)
5 views25 pages

Python Programming Lab Assignments

Uploaded by

Manasvi Arora
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)
5 views25 pages

Python Programming Lab Assignments

Uploaded by

Manasvi Arora
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

Indira Gandhi Delhi Technical University for Women

(Established by Govt. of Delhi vide Act 09 of 2012)

(Formerly Indira Gandhi Institute of Technology)


Kashmere Gate, Delhi – 110006

LABORATORY FILE
FOR
PROGRAMMING WITH PYTHON

Submitted to : Submitted by :
Ms. Ankita Singh Manasvi Arora
IT Department
IGDTUW, Delhi MCA(IT) – 1st Sem
INDEX
S. NO. LAB TITLE DATE TEACHER’S
SIGNATURE
LAB ASSIGNMENT – 1

[Link] “Hello World” in python IDE.


Code :

Output :
[Link] all the IDE’ s of python and compare them.

IDE / Editor Best For Pros Cons

PyCharm Professional Full-featured, great Heavy, Professional


development, for frameworks, Edition is paid
web apps debugging, DB tools

IDLE Beginners, Comes with Python, Very limited, not


quick testing very lightweight for big projects

VS Code General- Free, fast, Needs


purpose, customizable, large setup/extensions
Python + web extension library
+ ML

Replit Online coding, Runs in browser, no Internet required,


collaboration install, teamwork limited for heavy
friendly apps

Spyder Data science, MATLAB-like, variable Weak for web/app


scientific explorer, good for dev
computing analysis

PyDev Eclipse users Integrated with Complex setup,


(multi- Eclipse ecosystem slower
language performance
projects)
Jupyter Data science, Interactive coding, Not suitable for
ML, teaching visualization, great production apps
for reports

PyScripter Windows users Lightweight, fast, Windows-only,


needing good Python support fewer features than
lightweight IDE PyCharm/VS Code
3. What are python libraries? Use any 5-6 libraries and describe their
purpose.
Python libraries are collections of pre-written code that provide
useful functionalities, tools, or methods, allowing developers to
perform common tasks without writing code from scratch. These
libraries can be imported into Python projects to simplify complex
operations such as data analysis, machine learning, web
development, and automation. Over time, I’ve come across several
powerful Python libraries that have made coding not only faster but
also more efficient.
1. NumPy
NumPy (Numerical Python) is a core library for numerical
computing in Python. It provides support for large, multi-
dimensional arrays and matrices, along with a variety of
mathematical functions to operate on these arrays. I often find
it essential when dealing with scientific computations or
preparing datasets for analysis.
2. Pandas
Pandas is a powerful data manipulation and analysis library. It
introduces two primary data structures—Series and DataFrame
that make handling structured data intuitive and efficient. I
typically use Pandas for reading, cleaning, and analyzing data,
especially when working with CSV or Excel files.
3. Matplotlib
Matplotlib is a data visualization library used to create static,
animated, and interactive plots. Whether it’s a line chart, bar
graph, or scatter plot, I rely on Matplotlib to make my data
insights visually understandable. It pairs well with Pandas and
NumPy for plotting data from those structures.
4. Scikit-learn
Scikit-learn is a machine learning library that offers simple and
efficient tools for data mining and analysis. It supports various
algorithms like classification, regression, and clustering. I’ve
used it for training models, evaluating their accuracy, and
making predictions in small to mid-scale machine learning
projects.
5. Requests
The Requests library simplifies the process of sending HTTP
requests in Python. Instead of dealing with complex networking
code, I can use Requests to interact with APIs, download web
pages, or communicate with online services in a clean and
readable manner.
LAB ASSIGNMENT – 2

[Link] the number as input and check whether the number is


even or odd.

Code :

Output :
2. Take a year as input and check whether it is a leap year or
not.

Code :

Output :
3. Take a number as input and check whether it is a prime
number or not.

Code :

Output :
4. Take a number as input and check whether it is an
Armstrong number or not.

Code :

Output :
5. Write a program to swap two numbers.

Code :

Output :
6. Write a program for a menu-driven calculator that
performs basic operations (addition, subtraction,
multiplication, division).
Code :

Output :
7. Initialise different variables of various data types and check
their datatype using type().

Code :

Output :
8. Take three values as input and check whether a triangle is
valid or not using the triangle property.

Code :

Output :
9. Take a five-digit number as input and check whether it is a
palindrome or not.

Code :

Output :
10. Take a number as input and calculate its factorial.

Code :

Output :
11. Take a number as input and print its multiplication table
in the format: 5 x 1 = 5.

Code :

Output :
LAB ASSIGNMENT – 3

[Link] in python to demonstrate the use of range(), break


and continue.
Code :

Output :
2. WAP to show the following pattern using loops in python.
i) Code :

Output :

ii) Code :

Output :
iii) Code :

Output :
LAB ASSIGNMENT – 4

[Link] in python to demonstrate the following pattern using


a nested for loop.

Code :
Output :

2. Write a python program to count the number of even and


odd numbers from a series of numbers.

Code :

Output :
3. Write a python program that prints all numbers from 0 to 6
except 3 and 6.

Code :

Output :

4. Print first 10 natural numbers using while loop.

Code:

Output :
5. Print the following pattern

Code :

Output :

6. Display numbers from -10 to -1 using for loop.

Code :

Output :
7. Print the following pattern.

Code :

Output :

You might also like