What function allows our program to retrieve data from the user? →
The built-in function, input, reads in a line of input from the user. Input returns this as a value in your program. What type is the value that is returned by input? →
Input always returns a string.
What will this program output to the screen if the user types in 'apprehensive'? →
What will this program output to the screen if the user types in 20? →
We get a run-time error! (TypeError: can't multiply sequence by non-int of type 'str')
How would we fix this program? →
We can convert the string that we get from input into an int by using the int function…
Using function composition, we could also call int on the return value of input:
Let's take a look at that handout again.