You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5.5 KiB

In [1]:
print("What's the recipe's name?")
title = input()

print("Provide a description for the recipe")
description = input()

print("Who is the chef?")
chef = input()

print("Which ingredients do you need? Please write them separated by a comma")
ingredients = [ingredient.strip() for ingredient in input().split(',')]


print("Which steps do you need to follow to cook the recipe? Please write them separated by a comma")
instructions = [instruction.strip() for instruction in input().split(',')]
What's the recipe's name?
Provide a description for the recipe
Who is the chef?
Which ingredients do you need? Please write them separated by a comma
Which passages do you follow to cook the recipe? Please write them separated by a comma
In [2]:
import json
recipe = {
    "title":title,
    "description": description,
    "chef": chef,
    "ingredients": ingredients,
    "instructions": instructions
}


cms = ''

with open('cms.json', 'r') as file:
    cms_string = file.read()
    cms = json.loads(cms_string)

cms["recipes"].append(recipe)

with open('cms.json','w') as file:
    file.write(json.dumps(cms))
    print('Thank you for your contribuition')
{"recipes": [{"title": "Pizza and fruit salad soup", "description": "Minim laborum ipsum sunt minim nulla officia cillum quis labore ad voluptate enim deserunt nulla.", "chef": "chef Malvozzo", "ingredients": ["\ud83c\udf55", "\ud83e\udd6d", "\ud83c\udf49", "\ud83c\udf48"], "instructions": ["Id est velit ullamco ea sint aliqua laboris incididunt consectetur do aliqua sint eiusmod.", "Mescola", "Pariatur eu exercitation ipsum qui e", "Quis pariatur magna id pariatur consectetur irure in sint.", "Culpa sunt non consequat consequat excepteur amet ut veniam cupidatat in occaecat consectetur velit.", "servire ben caldo!"]}, {"title": "Kip & Ice Kream Siup", "description": "Id consequat deserunt laborum ea commodo sit voluptate sunt commodo excepteur sit incididunt amet.", "chef": "Mad Moonfish", "ingredients": ["\ud83c\udf57", "\ud83c\udf5a", "funghetti", "\ud83c\udf49", "\ud83e\udd57"], "instructions": ["Exercitation eiusmod adipisicing ex ut amet qui minim est anim reprehenderit nulla voluptate quis.", "Occaecat anim veniam occaecat ut pariatur culpa sit reprehenderit ullamco cupidatat.", "Et reprehenderit mollit cillum Lorem est.", "Magna aliquip sint aliqua proident.", "sluuuurp"]}, {"title": "NLTK Soupa", "description": "A delicious soup made with natural language tomato and kiwi", "chef": "Python", "ingredients": ["pasta", "mushroom", "pizza", "internet"], "instructions": ["Cook the pasta in the internet", "Dig a hole near a mushroom", "Bury the pizza in the hole", "Turn off internet", "Drain the pasta", "Turn internet on again"]}, {"title": "A new sup", "description": "just a test soup to see how does the cms taste like", "chef": "python", "ingredients": ["computer", "soupboat", "jupiter", "zen"], "instructions": ["turn on the computer", "enter the soupboat", "access jupiter", "start the kernel with little zen", "put python to boil", "wait and shift enter"]}, {"title": "Misu sup", "description": "A tasty misu sup yes yes yes", "chef": "Mitsos", "ingredients": ["Miso", "Water", "Salt", "Hash", "Egg", "Oil", "Pepper", "Glitter", "Mushrooms"], "instructions": ["Take the glitter and put them on your face", "Boil the water", "Throw the mushrooms in the boiling water", "Throw an egg against your neighbour", "Add salt and pepper", "Enjoy"]}, {"title": "A visual studio soup", "description": "A soup from the jupiter lab in visual studio ecc ecc really testy", "chef": "Visual sudo", "ingredients": ["Visual Studio", "Zen", "soup-gen repo", "git", "soupboat"], "instructions": ["Open visual studio and pull the repo from git", "Follow the jupiter notebook", "hope it works", "commit and push all the changes", "update the soupboat"]}]}
In [ ]: