input() is waiting for you to enter something because that's part of its documented function:
input([prompt])
If the prompt argument is present, it is written to standard output without a
trailing newline. The function then reads a
line from input, converts it to a string (stripping a trailing
newline), and returns that. When EOF is read, EOFError is raised.
So looking at the example given:
s = input('--> ')
You're calling the input() function, which does the following:
- Prints the optional prompt argument (
-->) to standard output (in this case is your console);
- Reads a line from standard input (ending when you supply a newline by pressing Enter);
Either:
a. Removes the trailing endline from the input and converts the remainder to a string (if an end of file condition has not been detected)
b. Raises an EOFError error (if an end of file condition has been detected)
- Returns the string.
The returned string is then stored in a variable called s. In a non-interactive program, if you wanted to display the value stored in s, you would have to use:
print(s)
Instead of simply s.
input, what do you not understand? – G-Man Says 'Reinstate Monica' Apr 07 '18 at 02:37swhen you typed insand pressed Enter. – muru Apr 07 '18 at 02:41