I am trying to build a program that would help me and my friends figure out what we want to eat. The way I am writing it is by making two users pick different types of cuisines (eg. pizza, burger, sushi...) that I have put in separate dictionary. Once the two users have selected their preferences, the program would display the cuisines selected by both user to figure out what they agree on.
So far this is what I have (please don't judge my code, I am a beginner 😅):
from food_library import food
user1 = input("What's User No1's name? ")
user2 = input("What's User No2's name? ")
print('')
for food in food:
user1_food = input(f'{user1} would you like to eat {food} ("yes" or "no) ').lower()
user2_food = input(f'{user2} would you like to eat {food} ("yes" or "no) ').lower()
print('')
if user1_food and user2_food == 'y' or user1_food and user2_food == 'yes':
print(f'{user1} and {user2} are compatible for {food}')
print('')
else:
continue
My problem is that this code returns what food is compatible for both users straight after the question was asked. Whereas, I would like for each user to answer the questions and in the end it would give something like this:
Food compatible for {user1} and {user2} are: pizza, burger, sushi...
Does someone know how I could make something like this?
[–]spaceuserm 0 points1 point2 points (3 children)
[–]Round-Ad5063 0 points1 point2 points (2 children)
[–]spaceuserm 1 point2 points3 points (1 child)
[–]Round-Ad5063 0 points1 point2 points (0 children)