Implementation of stdin and stdout
📁 Help, example
In the task (besides the algorithm itself) it is necessary to implement receiving data via stdin and output via stdout. Previously, I usually implemented receiving via input and output via print or simply returned a value without printing via retu. I don't understand how to receive data using stdin/stdout. I would greatly appreciate a link or code example to figure it out.
Underscore is just as valid a variable name as x, for example.
That is, from the interpreter's point of view, the expressions for _ in range(5) and for x in range(5) are no different and will execute identically.
It's just a tradition to use underscore to indicate that this variable is not used anywhere else. That is, we are using some syntactic construct that requires creating a new variable, but we don't need this variable itself, but rather some other effects from this syntactic construct.
The expression for _ in range(5) is usually used simply to repeat something 5 times. On each iteration, the variable _ will sequentially take the values 0 through 4.
Log in to leave an answer