Last active
February 17, 2022 13:09
-
-
Save neroist/cb71f07fa17430d0751b949dc91ea569 to your computer and use it in GitHub Desktop.
Revisions
-
neroist revised this gist
Feb 17, 2022 . 1 changed file with 16 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,26 +4,33 @@ import requests response = requests.get('https://breakfastapi.fun/').json() recipe = response['recipe'] name = recipe['name'] time = recipe['total_duration'] ingredients = recipe['ingredients'] directions = recipe['directions'].split('.') del directions[directions.index('')] # directions has an empyt string in it directions.append("And enjoy!") # add message to the end of the directions print('Recipe Name:', name, '\n') print('Cook Time:', time, f'({time / 60} hours)', '\n') # ! be careful of repeating decimals ## --- Print ingredients --- print('Ingredients:') for i in ingredients: print(f' - {i.title()}') ## --- Print directions --- print('\nDirections: ') for i in directions: print(f'{directions.index(i) + 1}. {i.strip()}') print() # print newline -
neroist revised this gist
Feb 10, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,3 +25,5 @@ for i in directions: print(f'{directions.index(i) + 1}. {i.strip()}') print() # print newline -
neroist created this gist
Feb 9, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ """ A console application for finding breakfast recipes using the BreakFast API. """ import requests response = requests.get('https://breakfastapi.fun/').json() name = response['Recipe Name'] time = response['Cook Time (Minutes)'] ingredients = response['Ingredients'] directions = response['Directions'].split('.') del directions[directions.index('')] print('Recipe Name:', name, '\n') print('Cook Time:', time, f'({time / 60} hours)', '\n') print('Ingredients:') for i in eval(ingredients.replace("'", '"')): print(f' - {i}') print('\nDirections: ') for i in directions: print(f'{directions.index(i) + 1}. {i.strip()}')