Shortcut
Challenge 2-2: Inputs
Challenge 2-2: Inputs
A shortcut:
>>> def hello_there():
name = input("Type your name: ")
print("Hi", name, "how are you?")
You can specify the prompt for the input() function directly inside the function. The prompt is the text that the function will print to ask a user for input.
Now what happens when you call the function? Does anything change?
>>> hello_there()
Type your name: John
Hi John how are you?