Several inputs
A program can call input as many times as it needs. Each call reads the next line the user types, and each answer usually goes into a variable of its own:
dish = input("Dish: ")
drink = input("Drink: ")
print("Your order: " + dish + " with " + drink)
pizza
lemonadeDish: pizza
Drink: lemonade
Your order: pizza with lemonadeThe answers come in the order the program asks for them. A test on this site types one line for each input, in that same order.
A new value replaces the old one
When you store a new value in a variable that already has one, the old value is gone for good. That's fine when you're done with it:
guess = input("First guess: ")
print("You said " + guess)
guess = input("Second guess: ")
print("Now you say " + guess)
blue
redFirst guess: blue
You said blue
Second guess: red
Now you say redIt's a bug when you still need the first value. Here both answers go into place, so the first one is lost before the program prints it:
place = input("Where were you born? ")
place = input("Where do you live now? ")
print("Born in " + place)
print("Living in " + place)
Oslo
RomeWhere were you born? Oslo
Where do you live now? Rome
Born in Rome
Living in RomeThe fix is a variable for each value you need to keep, such as birthplace and home.
Printing several values with commas
print can take several values separated by commas. It prints them all on one line, with a space between each two:
first = input("First word: ")
second = input("Second word: ")
print(first, second)
print("You typed", first, "and", second)
sun
flowerFirst word: sun
Second word: flower
sun flower
You typed sun and flowerSo commas add the spaces for you, and + adds nothing. print("Hi", name) and print("Hi " + name) print the same line. When something must come right after a value, with no space, use +: print(name, "!") prints Ada !, but print(name + "!") prints Ada!.