Example
Challenge 2-2: Inputs
Challenge 2-2: Inputs
Here’s another way to interact with Python and pass input to a function.
The input() function takes input from the user - you give that input to the function by typing it.
>>> def hello_there():
print("Type your name:")
name = input()
print("Hi", name, "how are you?")
Now what happens when you call this function?
>>> hello_there()
Type your name:
Barbara
Hi Barbara how are you?