BP101T • Basics of Python Programming for Pharmaceutical Sciences

Introduction to Python programming

Python is a high-level, interpreted, general-purpose programming language used to develop software, websites, applications, automate tasks, perform data analysis, and build artificial intelligence systems.

Python was created by Guido van Rossum and was first released in 1991.

Python is popular because its syntax is simple, readable, and easy to learn.

Example of a Python program:
print("Hello World")
Output:
Hello World
Try it Yourself »

Features

  • •
    Easy to Understand: Python has a simple syntax that is easy to learn and understand for those who do not have a computer science background.
  • •
    Open Source: Python is free to use, no licensing costs involved, which encourages a wide user base and extensive development.
  • •
    Strong Community Support: A vibrant community provides plenty of resources, tutorials and help when learners face any problems.
  • •
    Cross Platform Compatible: Python code can run on any machine for ex windows, linux, MacOs.
  • •
    Rich Libraries and Tools: Python has a huge amount of pre-written libraries and modules which help in speeding up development by reusing existing code.

Applications of Python

01

1. Artificial Intelligence (AI)

Used in machine learning, deep learning, and AI applications.

02

2. Scientific Research

Used in computational chemistry, molecular modelling, QSAR, and scientific calculations.

03

3. Web Development

Used to develop websites and web applications.

04

4. Data Science

Used for data analysis, visualization, and statistical calculations.

05

5. Automation

Used to automate repetitive tasks and processes.


Installing python:

1

Step 1. Open your browser and go to python.org/downloads

2

Step 2. Click the big yellow Download Python button. The file will download.

https://www.python.org/downloads/
Step 1 & 2: Download Page
Official Python Download Page with Download Button
3

Step 3. Double-click the downloaded file to start the installer.

4

Step 4. On the first screen, check the box that says "Add python.exe to PATH" at the bottom.

⚠️ This one box is important. Don't skip it.

Python Setup Wizard
🚨 Must Check: Add python.exe to PATH
Python Installer Screen with Add to PATH Checkbox
5

Step 5. Click Install Now. Wait for it to finish, then click Close.

6

Step 6. Open a new PowerShell window. (Press Win, type powershell, press Enter.)

7

Step 7. Type this and press Enter:

python --version
8

Step 8. If you see something like Python 3.13.x, it means successfully installed in your computer.

Setup Completion
Step 8: Installation Finished ✓
Python Setup Wizard Setup was Successful Screen

Integrated Development Environment (IDE):

“An IDE (Integrated Development Environment) is a software program where you can write, run, and fix your code.”

Instead of using three separate things — a text editor to type code, a terminal to run it, and a debugger to find mistakes — an IDE puts all of them in one window.

Integrated →
everything is in one place
Development →
for building software
Environment →
the workspace where you do it.

Installation of Jupyter Notebook:

Jupyter Notebook is a web-based digital notepad where you can write code, run it line-by-line, and see results instantly in one place.

Step 1 — Download

Go to anaconda.com/download and click the download button for your system.

Step 2 — Run it

Double-click the downloaded file.

Step 3 — Click Next

Keep clicking Next / Install until it finishes. Don't change anything.

Step 4 — Open Jupyter

Open Anaconda Navigator from your Start menu. Click Launch under the Jupyter Notebook.

http://localhost:8888/
Step 4: Jupyter Notebook Running
Jupyter Notebook Web Interface

Installation of PyCharm:

PyCharm is a powerful, professional-grade code editor (an IDE) built specifically for Python by JetBrains.

2

Step 2. Scroll to the Windows section. You'll see two versions:

  • Professional — paid, free 30-day trial
  • Community — free forever
3

Step 3. Click Download under Community. That's all you need.

4

Step 4. Double-click the downloaded file.

5

Step 5. Open the file then click Next, then Next again on the install location screen.

6

Step 6. On the options screen, check these boxes:

  • Create Desktop Shortcut
  • Add "bin" folder to the PATH
  • .py (so Python files open in PyCharm)
PyCharm Community Edition Setup
Step 6: Installation Options
PyCharm Installation Options Setup Screen
7

Step 7. Click Next, then Install, then Finish.


VS Code:

It is free, made by Microsoft, and the most popular editor for Python.

Installation

1

Step 1. Go to code.visualstudio.com

2

Step 2. Click the blue Download for Windows button.

3

Step 3. Double-click the downloaded file to run the installer.

4

Step 4. Accept the license agreement and click Next.

5

Step 5. Keep clicking Next through the screens. On the "Select Additional Tasks" page, check "Add to PATH" — it's usually checked already.

Visual Studio Code Setup
Step 5: Select Additional Tasks (Add to PATH)
Visual Studio Code Setup Wizard with Add to PATH Checkbox
6

Step 6. Click Install, wait, then click Finish.


Advantages of IDEs over text editors:

A text editor only lets you type. Notepad is a text editor. An IDE gives you tools that catch mistakes and save time.

The Main Advantages

1

Finds mistakes before you run the code

A text editor won't tell you a variable name if it is spelled wrong. An IDE underlines it in red immediately — before you even run the program.

2

Autocomplete

The IDE suggests what you're typing and finishes it for you. For ex. If you Type pri and it offers print(). So you can write faster and error free.

3

Runs code in the same screen:

No switching to a terminal. Click Run, see the output at the bottom.

4

A real debugger

When code breaks, an IDE can pause the program mid-run so you can look inside variables and see exactly where it went wrong. A text editor gives you nothing — just an error message.

5

Understands your project

An IDE knows all your files belong together. Rename a variable and it updates everywhere. Jump to where a function is defined with one click.

6

Built-in terminal and Git

Version control and command line live inside the same window.