The input and pass Statements
Learn about receiving input values from the keyboard, and the pass statement.
We'll cover the following
Receiving input
Because of the way the print()
function is used to output values on the screen, the built-in input()
function can be used to receive input values from the keyboard.
The input()
function returns a string. For example, if 23
is entered, it returns '23'
. So if we wish to perform an arithmetic function on the number entered, we need to convert it into int
or float
, as shown below.
We’ll type the input in the text bar. All input values will be in separate lines because an input()
function can read a complete line as a single input.
Get hands-on with 1200+ tech skills courses.