Experiment 1
Aim:
To install the latest version of Python, set up selected Integrated Development
Environments (IDEs) for Python development, compare 2-3 popular Python IDEs,
and explain the rationale for selecting one preferred IDE.
Requirements:
● A computer running Windows, macOS, or Linux.
● Internet connection for downloads.
● Administrative privileges (if required for installation).
● Approximately 1-2 GB of free disk space.
Introduction/Theory:
Python is a versatile, high-level programming language widely used for web
development, data analysis, automation, and more. Installing Python is the first step
for any development work. An IDE enhances productivity by providing tools like
code editing, debugging, and project management.
In this experiment, we will install Python 3.14.2 (the latest stable version as of
January 2026). We will then install and compare three popular Python IDEs: Visual
Studio Code (VS Code), PyCharm (Community Edition), and Spyder. These were
selected for their popularity, features, and suitability for different use cases (general
development, professional projects, and data science).
Procedure:
Step 1: Installation of Python-
Download the latest Python installer from the official website: [Link]/downloads.
Select Python 3.14.2 or the newest stable release.
On Windows:
1. Download the Windows installer (.exe) from the Python website.
2. Run the installer as administrator.
3. Check the box "Add Python to PATH" during installation.
4. Follow the on-screen instructions to complete the setup.
5. Verify by opening Command Prompt and typing python --version. It should
display "Python 3.14.2".
On macOS:
1. Install via Homebrew (recommended): Open Terminal and run brew install
python3 (install Homebrew first if needed: /bin/bash -c "$(curl -fsSL
[Link]
2.
a. Alternatively, download the macOS installer (.pkg) from the Python
website and run it.
3. Follow the installer prompts.
4. Verify by opening Terminal and typing python3 --version. It should display
"Python 3.14.2".
On Linux (e.g., Ubuntu):
1. Open Terminal and update packages: sudo apt update.
2. Install Python: sudo apt install python3 python3-pip.
a. For the very latest version, download the source from [Link],
extract, and compile: ./configure, make, sudo make install.
3. Verify by typing python3 --version. It should display "Python 3.14.2".
After installation, create a virtual environment for projects: python -m venv myenv
(activate with myenv\Scripts\activate on Windows or source myenv/bin/activate on
macOS/Linux).
Step 2: Installation of IDEs-
1.Visual Studio Code (VS Code)
1. Download VS Code from [Link].
2. Run the installer and follow the prompts (available for Windows, macOS,
Linux).
3. Open VS Code, go to Extensions (Ctrl+Shift+X), search for "Python" by
Microsoft, and install it.
4. Select your Python interpreter: Open Command Palette (Ctrl+Shift+P), type
"Python: Select Interpreter", and choose the installed version.
5. Create a sample file (e.g., [Link]) and run it using the play button
or F5 for debugging.
2.PyCharm (Community Edition)
1. Download the Community Edition from
[Link]/pycharm/download (free version; select .exe for
Windows, .dmg for macOS, or .[Link] for Linux).
2. Run the installer:
a. On Windows/macOS: Double-click and follow prompts.
b. On Linux: Extract the archive and run bin/[Link].
3. On first launch, configure the Python interpreter: Go to File > New
Project, select your installed Python.
4. Create a new project and test with a simple script.
3.Spyder
1. Install via pip (after Python setup): Open Terminal/Command Prompt
and run pip install spyder.
a. Alternatively, install Anaconda from [Link]/download, which
includes Spyder (recommended for data science).
2. Launch Spyder: Type spyder in Terminal/Command Prompt, or open from
Anaconda Navigator.
3. Configure the Python interpreter if needed (usually auto-detected).
4. Test by writing and running a script in the editor pane.
Selection and Rationale:
I chose Visual Studio Code (VS Code) as the preferred IDE.
Why? VS Code strikes an excellent balance between being lightweight and powerful,
making it suitable for beginners and advanced users alike. It starts quickly, consumes
fewer resources than PyCharm, and offers extensive customization through
extensions (e.g., Python, Jupyter, GitLens). Unlike Spyder, which is niche for data
science, VS Code supports multi-language projects and integrates seamlessly with
tools like Git and terminals. It's free, open-source, and has a massive community for
support. In my "experience" as an AI, VS Code's versatility aligns with diverse tasks,
from scripting to full applications, without the overhead of heavier IDEs.
Observations/Results
1. Python installed successfully and verified via command line.
2. All IDEs launched and ran a simple "Hello World" script.
3. Comparison revealed trade-offs: VS Code for speed/flexibility, PyCharm
for depth, Spyder for data-focused work.
Conclusion
This experiment demonstrates the straightforward installation of Python and IDEs
across platforms. Among the compared IDEs, VS Code is recommended for its
efficiency and adaptability, making it ideal for most Python development needs.
Users can select based on specific requirements, such as data analysis (Spyder) or
enterprise projects (PyCharm
EXPERIMENT 2
1. Write a program to print all Prime Numbers in a Range Input two numbers start and
end. Print all prime numbers between them.
a = int(input("enter first number"));
b = int(input("enter second number"));
def isPrime(k):
for j in range(2,k//2+1):
if k % j == 0:
return False
return True
for i in range(a,b+1):
if isPrime(i):
print(i)
else:
continue
Output:
enter first number5
enter second number74
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
2. Write a program to find Factorial using Function + Loop Input number n, find
factorial.
def factorial(x):
if x == 1 or x == 0 :
return 1
elif x < 0 :
print("factorial can't be calculated for negative
number")
return -1
else:
return factorial(x-1)*x
a = int(input("enter a number to find its factorial: "))
print("\n")
# factorial using loop
loopFact= 1
for i in range(1,a+1):
loopFact *= i;
print("factorial using loop: ", loopFact)
print("factorial using recursive function: ",factorial(a))
Output:
enter a number to find its factorial: 3
factorial using loop: 6
factorial using recursive function: 6
3. Write a program for Student Grade System
Input marks of 5 subjects.
Calculate total, percentage and grade.
Create functions:
• total_marks(marks_list)
• percentage(total)
• grade(percent)
Grade rules:
• ≥ 90 → A
• ≥ 80 → B
• ≥ 70 → C
• ≥ 60 → D
• else → Fail
def total_marks(x ):
sum = 0
for i in range(0,len(x)):
sum += x[i]
return sum
def percentage(total):
return total/5
def grade(percent):
if percent >= 90:
return "A"
elif percent >= 80:
return "B"
elif percent >= 70:
return "C"
elif percent >= 60:
return "D"
else:
return "Fail"
marks = [0]*5
for i in range(0,5):
marks[i] = int(input("enter marks for 5 subjects: "))
print("Total marks: ",total_marks(marks))
print("Percentage: ",percentage(total_marks(marks)))
print("Grade: ",grade(percentage(total_marks(marks))))
Output:
enter marks for 5 subjects: 33
enter marks for 5 subjects: 55
enter marks for 5 subjects: 77
enter marks for 5 subjects: 36
enter marks for 5 subjects: 99
Total marks: 300
Percentage: 60.0
Grade: D
4. Write a program to perform Digit Operations Input a number and find:
• count digits • sum of digits • reverse of digits Use separate functions for each
def count(x):
return len(str(x))+1
def sumDigits(x):
sum = 0
x = str(x)
for i in range(0,len(x)):
sum += int(x[i])
return sum
def reverse(x):
return str(x)[::-1]
a = int(input("enter a number"))
print("count of digits: ",count(a))
print("sum of digits: ",sumDigits(a))
print("reverse of digits: ",reverse(a))
Output:
enter a number: 3253
count of digits: 5
sum of digits: 13
reverse of digits: 3523