🧩Input and Output
Also known as I/O, IO
What goes into a program, and what comes out. Short form: I/O.
Think of it like
Think of it like a juice maker. Fruit goes in the top, and juice comes out the spout.
Example
A weather app takes a city name as input. Its output is the forecast for Tokyo, shown on the screen.
Definition
Example code
python
>>> name = input("Your name? ")
Your name? Jack
>>> print("Hi, " + name)
Hi, JackCommon mistake
Key takeaways
- 1In, work, out. Most programs take in, change, then give back.
- 2Many kinds. Keys, files, screens and sounds all count.
- 3Check what comes in. Bad input is a common cause of bugs.