OBSERVATIONS - Example 1 1. The input function can include a text within the parentheses that is
displayed when reading from the keyboard:
input("message")
The message provides a hint about what needs to be entered.
Pay attention to details and how your program interacts with the user. You know what you have programmed there,
but you need to clearly and elegantly indicate to a layperson what and how to do it.
2. The program reads a string from the keyboard stored in the variable name.
The print statement displays a string formed from "Hello, " and the entered value.
In the print statement, we used the "+" operator to concatenate (join) the two strings:
"Hello, " + "John" → "Hello, John"
(you will learn these concepts in detail a bit later)
OBSERVATIONS - Example 2
Great, isn't it?
Important. When the input function is executed, the program stops
and waits for input from the user until the Enter key is pressed or the Ok button in the dialog box is clicked.
Note. When working on a computer in a traditional programming environment, the data will be entered directly into the console.
OBSERVATIONS - Example 3 Hey... but
2
+
3
doesn't equal
2
3
!?!
The answer is simple. The input function implicitly provides any entered
information as a string, and the "+" operator simply concatenated the two characters and displayed them in
the console, so the data type stored in the variables is essential.
To use them correctly, the data must be transformed as needed!
You will soon learn about data types and how to convert them accordingly.