Programming-Challenges/19 Develop the Favourite Foods Program/exercise-01.py

18 lines
462 B
Python

# Initialize as a clean empty list
foods = []
run = True
while run:
name = input("Enter a name: ")
food = input("Enter a favourite food: ")
foods.append([name, food])
user_choice = input("Would you like to add another student? (y/n): ")
if user_choice.strip().lower() == "n":
run = False
# Print in tabular format
print("\nName - Favourite Food")
print("-" * 25)
for person in foods:
print(f"{person[0]} - {person[1]}")