August 2019
Beginner
482 pages
12h 56m
English
A function that is basically the opposite of print, is input. This function takes some sort of question/statement as an argument, prints it, and requires a user to give an answer—this answer will be returned as a result of the function. It does work in Jupyter, but is mostly used in standalone scripts.
Let's have a look at the following example:
>>> name = input('Your name?')Your name? Guido>>> nameGuido
As you can see, when we run the input function, it halts the whole computation, waiting for the operator to type in the value; once a value is added, the program resumes.
Read now
Unlock full access