Console Input is how you, the developer, give information to the Python program.
It’s like handing a note with instructions. We use the input()
function for this.
Example:
1your_name = input("Hey there! What's your name? ") # `your_name` stores value Joe Doe
2print(f"Nice to meet you, {your_name}!")
3# Nice to meet you, Joe Doe!
In this example, the program first asks for your name and stores it in the your_name
variable.
Then, it uses that information to greet you personally.
Console Output is how the program shows you the results of its work.
Think of it as the computer writing back to you on the console (that black window where you run your code). We use the print()
function for this.
Example:
1number1 = 5
2number2 = 10
3sum_of_numbers = number1 + number2
4print(f"The sum of the two numbers is: {sum_of_numbers}")
5# 15
The program first adds two numbers and stores the result in sum_of_numbers
.
Then, it displays the result in your terminal 15
.