Conditional Statements in Python for Pharmacy Students (Clinical Decisions, Dose Adjustment & Toxicity Check)
Conditional statements in Python allow decision-making based on specific conditions. In pharmaceutical sciences, they are widely used for clinical decision support, dose adjustments, and toxicity monitoring.
๐ท What are Conditional Statements?
Conditional statements execute code based on whether a condition is True or False.
if condition:
statement
๐ท if Statement
Executes code only if condition is true.
temperature = 102
if temperature > 100:
print("Fever detected")
๐ท if-else Statement
Executes one block if true, another if false.
age = 30
if age > 60:
print("Reduce dose")
else:
print("Normal dose")
๐ท if-elif-else Statement
Used when multiple conditions exist.
temperature = 101
if temperature > 103:
print("High fever")
elif temperature > 100:
print("Mild fever")
else:
print("Normal")
๐ Dose Adjustment Example
age = 65
if age > 60:
print("Reduce dose")
else:
print("Standard dose")
๐ Toxicity Check Example
concentration = 15
if concentration > 10:
print("Toxic level")
else:
print("Safe level")
๐ Combined Clinical Condition
age = 70
kidney_issue = True
if age > 60 and kidney_issue:
print("Reduce dose significantly")
๐ง Memory Trick
- if โ Decision
- elif โ Multiple options
- else โ Default action
๐งช Practice Exercise
Create a program that:
- Takes patient temperature
- Displays fever condition
๐ MCQs
- Which keyword is used for decision-making?
a) loop
b) if
c) def
d) print
Answer: b - elif stands for:
a) else if
b) end if
c) else loop
d) exit if
Answer: a - Which condition checks toxicity?
a) if dose
b) if concentration > limit
c) if drug name
d) print()
Answer: b
โ FAQs
Why are conditional statements important in pharmacy?
They help in clinical decision-making such as dose adjustment and toxicity monitoring.
What is the difference between if and elif?
if checks the first condition, while elif checks additional conditions.
๐ฅ Download Clinical Logic Practice Problems
Includes dose adjustment and toxicity scenarios.
โก Next Topic: Nested Conditional Statements โ
Unit 2 Blog:
- Conditional Statements (if, if-else, if-elif) (You are on this page)
- Nested Conditions (clinical decision logic)
- Loops (for, while) โ repetition in pharma data
- Break & Continue (control flow)
- Functions (definition, arguments, return values)
- Modular Programming (Dose + BMI calculator)
Question Bank Unit 2: Control Structures & Functions
For more details: Basics of Python Programming for Pharmaceutical Sciences