Lab · School of Computer Science & Technology

Lab 1 — Variables & Data Types

⏱️ ~6 minutes · Use Python (any online editor). Solutions in solutions.html.

Goal

Create variables of each core type, then hit the classic "type" bug and fix it.

Tasks

  1. Create variables for a made-up student:

    • name (a string), age (an integer), gpa (a float), is_enrolled (a boolean).
  2. Print a sentence using them, e.g.:

    Ada is 25 years old, GPA 3.8, enrolled: True

    Use either + concatenation or an f-string (f"...").

  3. The bug: You receive the age as text from a form: age_text = "25". Try to compute age_text + 5. What happens? Read the error.

  4. The fix: Convert the text to a number first, then add 5. Print the result.

Stretch (optional)

What you're practicing

Declaring variables, the core types (int/float/str/bool), and type conversion — the everyday reality of turning messy text data into numbers.

Lab 2 →