Skip to main content
Mr. V. Dharshan
Assistant Professor
SBV Chennai Campus
Introduction to Python Programming
SCHOOL OF PHARMACY
(Approved by PCI, New Delhi)
BP101T: Basics of Python Programming for
Pharmaceutical Sciences (Theory)
UNIT – I
B. PHARMACY (2026) As Per NEP 2020
I SEMESTER
Learning Outcomes
• Define Python and explain its key characteristics as a programming language.
• Describe why Python is relevant to pharmaceutical sciences and research.
• Differentiate the Python interpreter from an Integrated Development Environment (IDE).
• Explain the purpose and basic workflow of Jupyter Notebook, PyCharm and VS Code.
• Install Python and verify the installation from a terminal.
• Select an appropriate development environment for beginner pharmacy data work.
What is Python?
Definition
Python is a high-level, interpreted, object-oriented programming language with dynamic semantics.
• Readable syntax designed to emphasize clarity and reduce program-maintenance effort.
• Supports modules and packages, encouraging modularity and code reuse.
• Includes a broad standard library and a large ecosystem of third-party packages.
• Used for scripting, automation, scientific computing, data analysis, visualization and machine
learning.
Why Python in Pharmacy?
Drug & formulation data
Analyze experimental datasets, dissolution profiles and
formulation results.
Pharmacokinetics
Process concentration–time data and estimate PK
parameters.
Pharmacovigilance
Clean, merge and summarize adverse drug reaction
datasets.
Research & AI
Support statistics, visualization, machine learning and
cheminformatics workflows.
Why Choose Python?
Feature Why it matters to pharmacy students
Readable syntax Beginner-friendly; code is comparatively easy to read and maintain.
Free & widely available Can be installed without purchasing a commercial programming-language licence.
Scientific ecosystem NumPy, Pandas, Matplotlib, scikit-learn, RDKit and PyTorch support scientific workflows.
Rapid development Interactive execution and fast edit–test–debug cycles support experimentation.
Reusable code Functions, modules and packages allow repeated analyses and workflows.
Python Across the Pharmaceutical Pipeline
Discovery
Preformulatio
n
& formulation
Analytical
research
Clinical & PK
Pharmacovigi
lance
Data &
reporting
Key message
Python is not limited to one pharmaceutical function; it can connect data, computation and visualization across the
research lifecycle.
Python Interpreter vs IDE
Component Primary role Example
Python interpreter Reads and executes Python code. Python installed from python.org
IDE / development
environment
Provides an environment for writing, running, testing and
debugging code.
Jupyter Notebook, PyCharm, VS Code
Text editor Mainly edits text/code; fewer programming-specific tools. Notepad / basic editor
Remember
You need a Python interpreter to execute Python. An IDE is a productivity environment that makes coding easier.
Advantages of IDEs over Basic Text Editors
• Syntax highlighting improves code readability.
• Code completion / IntelliSense reduces typing and helps discover functions and methods.
• Error detection and linting can identify potential problems early.
• Debugger supports breakpoints, variable inspection and step-by-step execution.
• Integrated terminal / console supports interactive execution.
• Project and environment management helps organize larger programs.
• Notebook integration supports interactive data analysis in modern environments.
Installing Python: Basic Workflow
1
Download
the official Python
distribution for
your operating
system.
2
Install
On
Windows,
enable
“Add
Python to
PATH”
during
installation
.
3
Verify
run python --version.
4
Choose
Useenviron
ment
Use Jupyter,
PyCharm or VS
Code according
to your task.
5
Test
Run a
simple
Python
progra
m to
confirm
the
setup.
python --version
Output
Python 3.x.x
Important Windows Installation Step
Add Python to PATH
During the Windows installer, select the option to add Python to PATH. This allows Python to be called from Command
Prompt/Terminal.
python --version
Output
Python 3.x.x
python
Output
>>>
If it fails
A “command not found” / “not recognized” message commonly indicates that Python is not on the PATH or the wrong
environment is selected.
Jupyter Notebook
• Browser-based notebook environment designed for
interactive computing.
• Work is organized into cells; code can be executed cell-
by-cell.
• Outputs can appear immediately below code: numbers,
tables, plots and other rich results.
• Combines executable code with narrative text, equations
and visualizations.
• Especially suitable for exploratory pharmaceutical data
analysis and teaching.
Typical pharmacy use
Explore a PK dataset calculate summary
→
values visualize concentration–time data
→
document interpretation in the same
→
notebook.
Suggested starting point
For beginners and exploratory data work,
the supplied textbook recommends
starting with Jupyter Notebook.
Installing / Launching Jupyter
Route What it provides Typical use
Anaconda
Python + Jupyter + many scientific/data packages in one
distribution.
Beginner-friendly scientific computing setup.
pip Install Jupyter into an existing Python environment. Users who already manage Python environments.
VS Code + Jupyter
extension
Notebook editing and execution inside VS Code. Users who want notebooks + full code editor.
pip install jupyter
PyCharm
• Dedicated Python IDE from JetBrains.
• Designed for structured projects that may contain
multiple files and modules.
• Provides code completion, inspections, navigation,
testing and debugging.
• Supports Python environments and package
management workflows.
• Jupyter Notebook integration is available in the current
PyCharm product.
Best suited for
Larger Python projects, structured
application development, reusable modules
and debugging-heavy work.
Teaching point
An IDE becomes more valuable as the
project grows beyond a single notebook or
short script.
Visual Studio Code (VS Code)
• Lightweight, extensible code editor that can be configured
as a Python development environment.
• Install the Microsoft Python extension to add Python-
specific capabilities.
• Supports IntelliSense, linting, debugging, testing and
environment selection.
• Jupyter support can be added with the Jupyter extension.
• Works across major operating systems and with multiple
Python interpreters/environments.
Best suited for
Students who want one flexible editor for
Python scripts, notebooks, projects and
other programming languages.
Extensions → Python
Extensions → Jupyter
Jupyter vs PyCharm vs VS Code
Criterion Jupyter Notebook PyCharm VS Code
Learning / teaching Excellent Good Excellent
Exploratory data analysis Excellent Very good Very good
Large multi-file projects Limited / less natural Excellent Excellent
Interactive cells Core feature Supported Supported with Jupyter
Debugging Good Excellent Excellent
Extensibility Moderate High Very high
Recommended first choice ✓ Later Alternative
Practical recommendation
For B.Pharm beginners: start with Jupyter for interactive learning and data exploration; move to VS Code or PyCharm as projects
become larger.
Your First Pharmaceutical Python Program
drug = "Paracetamol"
dose_mg = 500
print("Dispensing", drug, "-", dose_mg, "mg tablet.")
Output
Dispensing Paracetamol - 500 mg tablet.
• Comments begin with # and are ignored by Python.
• Variables store values such as drug names and dose values.
• print() displays information to the user.
Pharmaceutical Examples: What Python Can Automate
Dissolution
Organize time–percentage data and
visualize dissolution profiles.
Pharmacokinetics
Calculate / visualize concentration–
time relationships and PK parameters.
Pharmacovigilance
Standardize ADR files, identify
duplicates and summarize reports.
Clinical research
Prepare datasets, perform calculations
and support simulation workflows.
Formulation R&D
Compare formulation batches and
analyze experimental measurements.
Data visualization
Generate publication-ready plots such
as line, scatter, histogram and box
plots.
Python Libraries: The Pharmaceutical Toolkit
Library / module Primary purpose Pharmacy-oriented example
math Mathematical functions Half-life, logarithms, exponentials
NumPy Numerical arrays and operations Experimental / PK numerical datasets
Pandas Tabular data analysis ADR reports, PK datasets, CSV/Excel files
Matplotlib Scientific plotting Concentration–time and dissolution curves
scikit-learn Machine learning Predictive modelling / classification
RDKit Cheminformatics Molecular structure and descriptor workflows
Common Setup Problems
Problem 1: Python not recognized
Check installation and PATH; verify with python --version.
Problem 2: Library will not import
The library may have been installed into a different Python
environment than the one used by the IDE.
Problem 3: Multiple Python installations
Choose one primary installation/environment unless you have
a clear reason to manage several.
Problem 4: Wrong interpreter in VS Code
Use Python: Select Interpreter and choose the intended
environment.
import sys
print(sys.executable)
Unit I — Key Takeaways
• Python is a readable, high-level language with a large scientific ecosystem.
• Pharmaceutical applications include PK, dissolution, pharmacovigilance, formulation data and
research workflows.
• Python interpreter executes code; an IDE improves coding, testing and debugging.
• Jupyter is ideal for interactive notebooks and exploratory data work.
• PyCharm is a full-featured Python IDE suited to structured projects.
• VS Code is a lightweight, extensible environment with strong Python and Jupyter support.
• Always verify the interpreter/environment before installing or importing packages.
Quick Check / Discussion
• What is the difference between a Python interpreter and an IDE?
• Why is Jupyter Notebook particularly useful for pharmaceutical data exploration?
• Name two advantages of an IDE over a basic text editor.
• Which environment would you choose for a large multi-file Python project? Why?
• What does python --version verify?
• Give two pharmaceutical tasks that could benefit from Python.
References
 Rajgude KD, Avachat VU, Swamy MR. Basics of Python Programming for Pharmaceutical Sciences. Wiseleaf Scientific
Ventures Pvt. Ltd., 2026. (Supplied course text; BP101T, Unit I).
 Pavadai P. Basics of Python Programming for Pharmaceutical Sciences. PharmaMed Press/BSP Books; 2026. ISBN: 978-81-6962014-7.
 Ahirwar R, Soni S, Singh AP, Vishwakarma N. A Text Book of Basics of Python Programming for Pharmaceutical Sciences. Shashwat
Publication; 2026. ISBN: 978-93-7462-551-4.