Skip to content

11 Python Tools and Applications

This notebook is a light tour of where Python can go next, not a heavy coding lesson. Dictionaries and libraries are exposure topics, not core mastery requirements for this course.

Run in Binder Open in Colab Download notebook

Read here. Practice in a notebook.

This page shows the original notebook. Open Binder or Colab to run and edit cells. Work one cell at a time: some examples are deliberately broken for debugging practice. Download your work before leaving Binder; its sessions are temporary.

View original source

Awareness Goals

By the end, you should be able to recognize that:

  • a dictionary can organize related details as structured data
  • a simple key can access one dictionary value
  • libraries give Python extra tools
  • Python has broader real-world uses that you can explore after this course

Concept Introduction (no code first)

Your core course skills are variables, input and output, types, arithmetic, comparisons, conditionals, Boolean logic, loops, lists, functions, debugging, and validation. This optional tour briefly shows dictionaries and libraries so you can recognize them later.

Dictionaries (Structured Data)

A dictionary stores data as key-value pairs, like a record or profile. Dictionaries can represent a user profile, system configuration, or other structured data.

Think Before You Run

What value do you expect Python to show for status?

# A small dictionary with system information
system = {"name": "Lab Printer", "status": "ready"}

print(system["status"])

Real-World Meaning of Dictionaries

Dictionaries are useful when one item has several details. For example, a device record can have a room and status.

Think Before You Run: What value will device["room"] return?

# Access one detail by using its key.
device = {"room": "A204", "status": "online"}

print("Room:", device["room"])

Light Modification Activity

Change one value in the dictionary, rerun the code, and observe the output.

# TODO: Change "available" to another short status.
laptop = {"name": "Loaner Laptop", "status": "available"}

print(laptop["name"], "is", laptop["status"])

Introduction to Libraries (concept only)

A library is prewritten code that allows us to perform tasks without building everything from scratch. We import a library when we want to use what it provides.

Library Demonstration (very short)

This example uses the random library to pick a simple support ticket priority.

Think Before You Run: What do you expect this to display?

import random

priority = random.choice(["low", "medium", "high"])
print("Ticket priority:", priority)

Think Before You Run

Run the random example more than once. Does the output always stay the same?

import random

check_number = random.randint(1, 3)
print("Random check number:", check_number)

Real-World Applications

Python can support IT systems, data handling, and automation. It can also support many fields:

  • Business: summarize sales or expenses.
  • Health: organize appointment or survey data.
  • Education: track scores or attendance.
  • IT: check systems, tickets, or device status.
  • Arts and media: organize files or generate simple text.

Functions help organize your code, while libraries provide ready-made functions.

Reflection / Discussion

Which Python capability do you want to explore next: organizing data, automating tasks, checking information, or using libraries?

Optional Micro Activity

Change the values below to describe a tool or device you use.

# Optional: change these values.
tool = {"name": "Browser", "use": "research"}

print(tool["name"], "is used for", tool["use"])

Common Mistakes

Common mistakes include misspelling a key, forgetting quotation marks around text, or expecting random output to stay the same every time.

Helpful reminders:

  • Use the exact key name, such as "status".
  • Keep text inside quotation marks.
  • Random choices may change each time you run the cell.

Wrap-Up

Python can do much more using tools and libraries. This course provides a foundation.

You can continue exploring Python tools in areas like data analysis, cybersecurity, and automation.