input() lets a program pause, ask the user for text, and keep the response. Call it with empty parentheses to wait silently, or pass a prompt so the user knows what to enter. After the user types and presses Enter, input() returns the entered text. section 1.2
Collecting a coffee order
A small coffee-shop program stores each answer in a clearly named variable, then prints the completed order: name = input("Please enter your name: ") drink = input("Please enter your drink: ") flavor = input("Please enter your flavor: ") topping = input("Please enter your topping: ") print("Here is your order, ", name) print("Main product: ", drink) print("Flavor: ", flavor) print("Topping: ", topping) Using separate variables matters: assigning every answer to answer would replace the previous response. The same pattern can place responses into a dictionary, such as order['name'] = input("What's your name: "). section 1.2 section 7.0
Listing 1.1 The first version of the coffee shop application
print("Welcome to Erik's Coffee Shop!")
name = input("Please enter your name: ")
drink = input("Please enter your drink: ")
flavor = input("Please enter your flavor: ")
topping = input("Please enter your topping: ")
print("Here is your order, ", name)
print("Main product: ", drink)
print("Flavor: ", flavor)
print("Topping: ", topping)
print("Thanks for your order!")
Run the complete coffee-shop application and compare each prompt with the resulting printed order. section 1.2






