Interactive Python

Choose an example. Edit the code. Run real Python.

← Python Foundations course
Choose a learning stage · 7 stages

Prepared input / stdin

Enter all answers here before running. Input is not echoed; prompts appear in the output. Missing lines produce EOFError. Reset restores the example inputs.

Ctrl / ⌘ + Enter to run. Tab inserts four spaces; Esc leaves the editor. Each run starts with fresh Python variables.

OUTPUT
Predict first · reveal original output

This is the output of the unchanged starter. Your edits may intentionally produce different results.

Quick self-check · explain it in your words

Reveal explanation

Practice marks are your own checklist, saved on this device. They do not grade your code. Code and prepared input are not saved with the marks.

Python loads on your first run (about 14 MB). Execution stays in this browser tab and resets after 10 seconds. Standard-library exercises; input() reads the prepared input box. Files are temporary browser files in a fresh folder per run. Extra package installation is not supported here. Work is not saved after closing or reloading this page. Download your code to keep it.

Garen, Ashe and Lux are used as a fan-made educational reference to League of Legends. All numbers and formulas are invented for this exercise; no live game data or artwork is used. This studio is not affiliated with Riot Games.

Python documentation: input, output & formatting ↗More practice: W3Schools Python ↗
Project brief & object design notes
PRACTISE INDEPENDENTLY

Your next build: the Latte Cafe order desk.

Combine the ideas in your own version. The lab runs each example independently; combine the required pieces explicitly instead of relying on variables or files from earlier runs.

01 / Specify

Known drinks only; whole positive quantities; prices in cents; unknown or invalid orders receive a clear message.

02 / Build in small steps

Start from the receipt example. Extract a calculation function, add validation, then save and reload the order as CSV or JSON.

03 / Review the evidence

Check two lattes plus one tea total 1200 cents, an empty order totals zero, and invalid quantities are rejected. Explain why each check exists.

In one-to-one online sessions, we can review your trace, debugging decisions and explanation, then choose the next exercise. These are studio-authored examples; UOW’s public subject descriptions inform topic coverage, not university affiliation or official assessment preparation.

OOA → OOD → OOP

Design the cafe before adding classes.

The same cafe story connects requirements, responsibilities and Python objects. The class starter is deliberately small; quantity validation is a follow-up exercise.

OOA

Understand the order

Name the drinks, prices, quantities and output. Decide how an empty order and an invalid quantity should behave before choosing classes.

OOD

Assign responsibilities

MenuItem owns its name and unit price. Order owns its lines and total. An order contains menu items through composition, rather than inheriting from an item.

OOP

Implement and check

Run “Model a cafe order”. Create separate orders, inspect their state and add validation. Check two lattes total 900 cents and an empty order totals zero.

MenuItemname · price_cents
Orderlines[] · add(item, quantity)
total_cents()

self refers to an instance. Each Order creates its own lines list in __init__; a mutable class-level list would be shared across orders. The optional hero example explores inheritance separately.

AI AS A LEARNING PARTNER

Ask for a review. Keep your judgement.

Begin with your own analysis. Ask an AI tool to question assumptions, critique responsibilities or propose edge cases. Check each suggestion against the brief and the running code, then explain what you accepted and why.

“Review this design without rewriting it. Identify one unclear responsibility and two edge cases. Ask me to clarify missing requirements before suggesting changes.”

This is a prompt you can use with your own AI tool. The lab does not call an AI service.

CHECK YOUR UNDERSTANDING

How should an order relate to menu items?

Extension: add quantity validation to Order.add(), test an empty order and explain which class owns each rule.

Website privacy

This page has no enquiry form, analytics service, or third-party font requests. Your language, appearance, and motion preferences are stored locally in this browser when storage is available.

If the site is hosted, the hosting provider may process standard request logs. Any future contact service will need its own information handling details.