Lesson 12 of 13

Input / Output: Talk to Your Code! 📤

Input is what YOU give the computer. Output is what the computer shows BACK. It’s a conversation — between you and your program!

📥 Input — You type:
What is your name?
📤 Output — Computer shows:
Hello, Sara! 👋
📥 Input — You type:
Sara
📤 Output — Computer shows:
Nice to meet you, Sara! 🎉
🤔 Input vs Output

Two Sides of Every Conversation!

Think of your program as a friend — it asks questions and gives answers!

📥

INPUT — You Give Info IN!

Input is any information you give to the program. Typing your name, clicking a button, pressing a key — all input!

🎤 Like talking INTO a microphone — the program listens!
name = input(“What is your name? “)
# User types: Sara
# name = “Sara” ✅
📤

OUTPUT — Program Shows Info OUT!

Output is anything the program shows back to you. Text on screen, sounds, images — all output!

🔊 Like a speaker playing BACK what you said!
print(“Hello, “ + name + “!”)
# Output shows on screen:
Hello, Sara! 👋

🌍 Input/Output Everywhere!

You Use Input/Output All Day Long!

Every device around you uses input and output!

⌨️

Keyboard & Screen

You type on the keyboard (input) and the computer shows the result on screen (output). Every word you type!

📥 Typing 📤 Screen display
🎮

Video Games

You press buttons (input) and the character moves on screen (output). Every game works this way!

📥 Button press 📤 Character moves
🔍

Google Search

You type a question (input) and Google shows you results (output). Millions of times a day!

📥 Search query 📤 Search results
🏧

ATM Machine

You enter your PIN and amount (input) and the ATM gives you cash and a receipt (output)!

📥 PIN + amount 📤 Cash + receipt

🎮 Talk to Your Program!

Interactive Program Simulator!

Choose a program — type your input — see the output instantly!

🤖
My Python Program
Running & ready for input!

💻 The Two Key Functions

print() and input() — Learn Both!

These two functions handle all input and output in Python!

🖨️

print() — Show Output!

Use print() to show any information on the screen. Text, numbers, variables — anything you want the user to see!

print(“Hello, World!”)
print(score)
print(“You scored:”, score)
# All show on screen! ✅
⌨️

input() — Get Input!

Use input() to ask the user a question and wait for their answer. Whatever they type gets stored in a variable!

name = input(“Name? “)
age = input(“Age? “)
print(“Hi”, name)
# Uses both together! 🎉

😅 Common Mistakes

3 Mistakes to Watch Out For!

Every beginner makes these — now you won’t have to!

age = input(“Age?”) + 1
🤔 input() always gives TEXT — even if you type a number! Convert it first with int().
✅ age = int(input(“Age?”)) + 1
print(Hello, World!)
🤔 Text in print() must be inside quotes! Without quotes Python thinks it’s a variable.
✅ print(“Hello, World!”)
input(“What is your name?”)
🤔 You asked but forgot to STORE the answer! Assign it to a variable!
✅ name = input(“What is your name?”)

🧠 Quick Quiz!
🎯 Input / Output Quiz

4 questions · pick an answer to check!

⭐ Remember This!

📥

Input = information you give TO the program (typing, clicking)

📤

Output = information the program shows BACK to you

🖨️

Use print() to show output on the screen

⌨️

Use input() to get input — always returns text!