How can I fix my code so a search for football recipes returns a sorry no matches response

import requests

app_id = '79f381d8'
app_key = '6d0c821df084f53a1ac53d1217343795'

def main():
global ingredient
ingredient = input('Find something to cook! \n \nTo get started, tell me which ingredient you\'d like in your recipe? \n')
results = recipe_search(ingredient)
results_by_ingredients = sort_by_ingredients(results, True)
#for i in results:
#if ingredient not in i['recipe']:
#print('Sorry, I did not catch that')
if len(results_by_ingredients) == 0:
print('Sorry, no results! Please start again and try a different ingredient.')

def recipe_search(ingredient):
url = '{}&app_id={}&app_key={}'.format(ingredient, app_id, app_key)

def sort_by_ingredients(r, reverse_order):
s = sorted(r, key=lambda i: len(i['recipe']), reverse = reverse_order)

def show_results(search_results):
for i in search_results:
name = i['recipe']
source = i['recipe']
url = i['recipe']
number_ingredients = len(i['recipe'])
calories = i['recipe']
servings = i['recipe']
calories_per_serving = int(calories / servings)


You are viewing a single comment. View All

@Coder100 thanks but please do not change code