Imagine you want a program to greet someone by their name. Why does the program need input?
Think about how the program can say hello to different people.
Input lets the program get information from the user, like their name, so it can respond properly.
What is the main reason a program shows output to the user?
Think about why you want to see answers or messages from a program.
Output is how a program shares what it did or found with the user, like showing answers or messages.
Look at this Python code. What will it print?
name = input('Enter your name: ') print(f'Hello, {name}!')
The program asks for your name and then says hello using it.
The input function waits for user input. If the user types 'Alice', the print shows 'Hello, Alice!'.
What error will this code cause?
print(f'Your age is {age}')
Think about what happens if you use a variable that was never given a value.
The variable 'age' was never set, so Python raises a NameError when trying to print it.
Choose the best reason why input and output are critical for programs used in daily life.
Think about how apps on your phone get information and show results.
Input and output let programs receive data and show results, enabling interaction and usefulness in real life.