Talking to Your Program (Using print
and input
)
A computer program is a bit like having a conversation. It usually follows three simple steps:
- Input: The program gets information (like you typing your name).
- Process: The program thinks about that information.
- Output: The program shows a result (like saying “Hello!” back to you).
In this lesson, we’ll focus on Input and Output.
print()
is a special command, or function, in Python. Its job is to show any message you want on the screen. Whatever you put inside the parentheses ()
is what it will show
When you want to print text, you must put it inside quotation marks ""
. For numbers, you don’t need quotes.
input()
is a function that makes your program pause and wait for the user to type something. It’s like asking a question and listening for an answer.The message you put inside the parentheses is the question the computer will ask.
Important: The computer always treats the answer you type in as plain text (programmers call this a string).