Let’s build a “Smart Syllabus Assistant” that calculates grades and visualizes class performance.
| Segment | Topic | Faculty Outcome |
|---|---|---|
| 0-10m | The Sandbox | Learning how to “Play” a cell in Colab. |
| 10-25m | Digital Folders | Using variables to store student names and scores. |
| 25-45m | The Grade Cruncher | Using Python to calculate averages and curves. |
| 45-60m | Visualizing Success | Turning a list of numbers into a professional chart. |
Instructions for Faculty: “Think of Google Colab as a digital notebook where you can write text and run code in the same place. No installation required.”
# This is a comment. The computer ignores it.
print("Coding is just a very literal assistant.")
The Concept: In programming, we store information in “variables.” Think of them as labeled folders on your desk.
Exercise: Create a new code cell and define a student’s data:
student_name = "Professor Smith"
midterm_score = 85
final_exam_score = 92
# Let's calculate the total
total_score = midterm_score + final_exam_score
print(f"{student_name} earned a total of {total_score} points.")
The Concept: Faculty rarely deal with one student. They deal with a class. We use Lists (square brackets []) to hold multiple values.
Exercise:
# A list of student scores
class_scores = [78, 92, 85, 64, 95, 88, 72]
# Python has built-in 'powers' (functions) to help us
number_of_students = len(class_scores)
highest_grade = max(class_scores)
average_grade = sum(class_scores) / number_of_students
print(f"Class Size: {number_of_students}")
print(f"Highest Grade: {highest_grade}")
print(f"Class Average: {round(average_grade, 2)}")
The Concept: This is the “Magic Moment.” We will use a library called matplotlib to turn those boring numbers into a visual report.
Exercise: Copy and paste this into a final cell to see the power of Python:
import matplotlib.pyplot as plt
# Data
students = ["A", "B", "C", "D", "E", "F", "G"]
scores = [78, 92, 85, 64, 95, 88, 72]
# Creating the chart
plt.bar(students, scores, color='skyblue')
plt.axhline(y=75, color='red', linestyle='--', label='Passing Grade') # A 'passing' line
# Adding labels
plt.title("Section 101: Midterm Results")
plt.xlabel("Student ID")
plt.ylabel("Score")
plt.legend()
# Show the plot
plt.show()
Wrap up by explaining that they just performed Data Science. They took raw data, processed it with logic, and generated a visualization—all in under an hour.
This “Cheat Sheet” is designed to be a single-page reference that faculty can keep open in a tab or printed on their desk. It focuses on the “grammar” of Python without the jargon.
Shift + Enter) to run the code in that cell.#): Anything after a # is a note for you. The computer ignores it.# This is a note to remind me what this does.Think of a variable as a labeled drawer where you store a piece of data for later.
| Type | Example | Use Case |
|---|---|---|
| String | name = "Dr. Smith" |
Text (always use “quotes”). |
| Integer | points = 100 |
Whole numbers for grades/counts. |
| Float | average = 85.5 |
Numbers with decimals. |
When you have a whole class, you use a List. Lists always live inside **square brackets []**.
class_grades = [88, 92, 75, 100]class_grades[0] (Computers start counting at zero!)Functions are pre-written shortcuts that do work for you. They always end in **parentheses ()**.
print() — Shows the result on your screen.len() — Tells you the length (how many items are in a list).sum() — Adds all the numbers in a list together.round(x, 2) — Rounds a number to 2 decimal places.In Python, space matters. If you are writing a “loop” or a “condition,” the code underneath must be indented (usually by hitting the Tab key). This tells Python, “This code belongs to the block above it.”
If your code turns Red, it just means the computer is confused.
", a bracket ], or a parenthesis ).Pro-Tip: Coding is 10% writing logic and 90% figuring out where you forgot to close a parenthesis. You’re doing great!