Slide 2: Agenda
1. Variables with plant examples
2. Lists in Python
3. Tuples in Python
4. Dictionaries in Python
5. Quick practice questions
Slide 3: Variables
A variable stores a value.
Example (Plant names):
plant = "Rose"
height = 45 # in cm
is_flowering = True
🌸 Output: Rose, 45, True
Slide 4: Lists
Stores multiple items in one variable.
Example:
plants = ["Rose", "Tulip", "Lily", "Neem"]
print(plants[0]) # Rose
✅ List is mutable (can be changed).
Slide 5: Tuples
Similar to lists but immutable (cannot change).
Example:
tree_tuple = ("Neem", "Banyan", "Peepal")
print(tree_tuple[1]) # Banyan
Useful when data should not change.
Slide 6: Dictionaries
Stores data in key-value pairs.
Example:
plant_info = {
"Rose": "Flowering Plant",
"Neem": "Medicinal Tree",
"Tulip": "Seasonal Flower"
}
print(plant_info["Neem"])
🌳 Output: Medicinal Tree
Slide 7: Comparison Table
Feature List Tuple Dictionary
Ordered ✅ ✅ ✅ (Py 3.7+)
Mutable ✅ ❌ ✅
Duplicates ✅ ✅ ❌ (keys)
Slide 8: Quick Exercise
💡 Try these:
1. Create a list of 5 medicinal plants.
2. Make a tuple of 3 fruit trees.
3. Create a dictionary with plant name as key and use as value.
Slide 9: Conclusion
Variables = Store values
Lists = Mutable collections
Tuples = Immutable collections
Dictionaries = Key-value pairs
🌱 Python makes plant data handling simple!
Mini Challenge Task
1. Create three lists: simple_leaves, compound_leaves, needle_like_leaves.
2. Add at least 3 plant names to each list.
3. Put these lists into a dictionary called leaf_types.
4. Print out the dictionary neatly.
Python Code
# Step 1: Create three lists
simple_leaves = ["Mango", "Guava", "Banana"]
compound_leaves = ["Neem", "Rose", "Gulmohar"]
needle_like_leaves = ["Pine", "Cedar", "Spruce"]
# Step 2: Store them in a dictionary
leaf_types = {
"Simple Leaves": simple_leaves,
"Compound Leaves": compound_leaves,
"Needle-like Leaves": needle_like_leaves
}
# Step 3: Print results neatly
for category, plants in leaf_types.items():
print(category, ":", plants)
✅ Output
Simple Leaves : ['Mango', 'Guava', 'Banana']
Compound Leaves : ['Neem', 'Rose', 'Gulmohar']
Needle-like Leaves : ['Pine', 'Cedar', 'Spruce']
🌿 Mini Challenge: Categorize Plants by Height
Objective (15 min)
Students will practice using lists, tuples, and dictionaries by categorizing plants into Small,
Medium, and Tall groups.
Slide Content for the Challenge
Slide Title: Mini Challenge 🌱
Instructions:
1. Create three lists: small_plants, medium_plants, tall_plants.
2. Add at least 3 plant names to each list.
3. Put these lists into a dictionary called plant_height.
4. Print out the dictionary neatly.
Starter Code (for students)
# Step 1: Create lists
small_plants = ["Tulip", "Rose", "Marigold"]
medium_plants = ["Hibiscus", "Sunflower", "Jasmine"]
tall_plants = ["Coconut Tree", "Banyan Tree", "Neem Tree"]
# Step 2: Store them in a dictionary
plant_height = {
"Small": small_plants,
"Medium": medium_plants,
"Tall": tall_plants
}
# Step 3: Print results
for category, plants in plant_height.items():
print(category, ":", plants)
Expected Output
Small : ['Tulip', 'Rose', 'Marigold']
Medium : ['Hibiscus', 'Sunflower', 'Jasmine']
Tall : ['Coconut Tree', 'Banyan Tree', 'Neem Tree']
Session2
Python & Plants — Hands-on Activities
🔄 Loops (15 min): Simulate Daily Plant Growth
Concept: Use for and while loops to simulate how a plant grows daily.
Example Code:
# Using for loop
height = 10 # starting height in cm
print("Initial height:", height)
for day in range(1, 6): # simulate 5 days
height += 2
print("Day", day, ": Plant height =", height, "cm")
# Using while loop
height = 10
day = 1
while day <= 5:
height += 2
print("Day", day, ": Plant height =", height, "cm")
day += 1
Expected Output:
Day 1 : Plant height = 12 cm
Day 2 : Plant height = 14 cm
...
Day 5 : Plant height = 20 cm
🌱 Functions (15 min): Write growth() Function
Concept: Create reusable code for plant growth simulation.
Example Code:
def growth(plant_name, start_height, days, daily_growth):
print(f"🌿 {plant_name} Growth Simulation")
height = start_height
for day in range(1, days + 1):
height += daily_growth
print("Day", day, ":", height, "cm")
return height
# Test the function
final_height = growth("Sunflower", 15, 7, 3)
print("Final Height:", final_height, "cm")
📊 Visualization (20 min): Plot Plant Height Bar Charts
Concept: Use Matplotlib/Seaborn to visualize plant growth.
Example Code:
import matplotlib.pyplot as plt
import seaborn as sns
plants = ["Rose", "Tulip", "Sunflower", "Neem"]
heights = [30, 25, 120, 300] # final heights in cm
# Matplotlib
plt.bar(plants, heights)
plt.title("Plant Heights")
plt.xlabel("Plants")
plt.ylabel("Height (cm)")
plt.show()
# Seaborn (prettier)
sns.barplot(x=plants, y=heights)
plt.title("Plant Heights (Seaborn)")
plt.show()
Expected Visualization:
🌸 A bar chart showing Rose, Tulip, Sunflower, Neem with different heights.
Session -3
Extended Hands-on Session Plan
📑 Data Handling (20 min): Pandas DataFrame with Plant Traits
Concept: Use pandas to handle tabular plant data.
Example Code:
import pandas as pd
data = {
"Plant": ["Rose", "Tulip", "Sunflower", "Neem"],
"Height_cm": [45, 30, 150, 300],
"Category": ["Flower", "Flower", "Flower", "Tree"],
"Medicinal": [False, False, False, True]
}
df = pd.DataFrame(data)
print(df)
Expected Output Table:
Plant Height_cm Category Medicinal
Rose 45 Flower False
Tulip 30 Flower False
Sunflower 150 Flower False
Neem 300 Tree True
⚡ Automation Example (15 min): Leaf Area Index (LAI) & Classification
Concept: Automatically compute and classify plants.
Formula (Simplified):
LAI=Leaf AreaGround AreaLAI = \frac{\text{Leaf Area}}{\text{Ground
Area}}LAI=Ground AreaLeaf Area
Example Code:
def classify_lai(leaf_area, ground_area):
lai = leaf_area / ground_area
if lai < 1:
category = "Sparse"
elif lai <= 3:
category = "Moderate"
else:
category = "Dense"
return lai, category
# Example
lai, category = classify_lai(5.0, 2.0)
print("LAI:", lai, "→", category)
Output:
LAI: 2.5 → Moderate
👥 Mini Project (20 min): Group Task
Activity for Students:
1. Load a plant dataset (CSV file). Example columns:
o Plant Name, Height, Category, Medicinal, Region
2. Use Pandas to:
o Find average height
o Count how many are medicinal
o Group plants by category
3. Plot a bar chart or pie chart for visualization.
Starter Code:
import pandas as pd
import matplotlib.pyplot as plt
# Load CSV
df = pd.read_csv("plants.csv")
# Insights
print(df.groupby("Category")["Height_cm"].mean())
print("Medicinal count:", df[df["Medicinal"]==True].shape[0])
# Plot
df["Category"].value_counts().plot(kind="bar")
plt.title("Plant Categories")
plt.show()
🏁 Wrap-up (5 min): Group Sharing & Discussion
Each group shares one insight from their CSV analysis.
Discuss: How can Python help in Botany Research?
Link back to:
o 🌸 Variables & Collections
o 🔄 Loops & Functions
o 📊 Visualization
o 📑 Data Handling & Automation