NOTE: I have completed the code for your assignment which has to be executed in python3. Please check and let me know if you face any issues. I will revert back within 24 hours.
Script:
Unix Terminal> cat number03.py
#!/usr/local/bin/python3
def main():
# declaring rest dictionary
rest = {}
# assigning options avaialble in each restaurant
rest[‘Joe’s Gourmet Burgers’] = {}
rest[‘Joe’s Gourmet Burgers’][‘veg’] = ‘No’
rest[‘Joe’s Gourmet Burgers’][‘vegan’] = ‘No’
rest[‘Joe’s Gourmet Burgers’][‘gf’] = ‘No’
# assigning options avaialble in each restaurant
rest[‘Main Street Pizza Company’] = {}
rest[‘Main Street Pizza Company’][‘veg’] = ‘Yes’
rest[‘Main Street Pizza Company’][‘vegan’] = ‘No’
rest[‘Main Street Pizza Company’][‘gf’] = ‘Yes’
# assigning options avaialble in each restaurant
rest[‘Corner Cafe’] = {}
rest[‘Corner Cafe’][‘veg’] = ‘Yes’
rest[‘Corner Cafe’][‘vegan’] = ‘Yes’
rest[‘Corner Cafe’][‘gf’] = ‘Yes’
# assigning options avaialble in each restaurant
rest[‘Mama’s Fine Italian’] = {}
rest[‘Mama’s Fine Italian’][‘veg’] = ‘Yes’
rest[‘Mama’s Fine Italian’][‘vegan’] = ‘No’
rest[‘Mama’s Fine Italian’][‘gf’] = ‘No’
# assigning options avaialble in each restaurant
rest[‘The Chef’s Kitchen’] = {}
rest[‘The Chef’s Kitchen’][‘veg’] = ‘Yes’
rest[‘The Chef’s Kitchen’][‘vegan’] = ‘Yes’
rest[‘The Chef’s Kitchen’][‘gf’] = ‘Yes’
# picking food choices from the user
veg = input(‘Is anyone in your party a vegetarian? ‘)
vegan = input(‘Is anyone in your party a vegan? ‘)
gf = input(‘Does anyone in your party require a gluten-free food? ‘)
# converting first letter of given choices in the food priorities
veg = veg.title()
vegan = vegan.title()
gf = gf.title()
# checking the restaurants available based on choices
rest_list = []
for r in rest.keys():
if rest[r][‘veg’] == veg or rest[r][‘veg’] == ‘Yes’:
if rest[r][‘vegan’] == vegan or rest[r][‘vegan’] == ‘Yes’:
if rest[r][‘gf’] == gf or rest[r][‘gf’] == ‘Yes’:
rest_list.append(r)
# displaying list of restaurants available based on choices
print(‘nHere are your restaurant choices:’)
for restaurant in rest_list:
print(restaurant)
if __name__==’__main__’:
main()
Output screenshot: