Unleash your inner digital chef through this simple (but mouth-watering) Python activity.
Who doesn’t love a good dessert? Whether it’s gooey fudge-brownie cake, piping hot peanut butter cookies, or rainbow popsicles with a thousand fruity flavours, I think we can all agree that sugary foods are awesome! To honour the sweet tooth, this activity is all about inventing new desserts. Using some simple Python code, we’re going to create a program that mashes flavours together into unexpected deliciousness.
Step 1: Setup
Navigate to www.replt.it and select ‘Python3’ from the ‘Search for a language’ bar:
Step 2: Create Lists
Now it’s time to put on your chef’s hat and get creative! Start by brainstorming three lists of words: one for flavours (chocolate, mint, watermelon), one for textures and bonus add-ons (sprinkles, cream, jelly), and one for desserts themselves (cake, brownies, parfait). Think up at least three words per category. When you’re done, code them up like so in the left-hand editor:
flavour = ["cherry", "chocolate", "vanilla", "caramel"] bonus = ["swirl", "volcano", "mousse", "sprinkles"] dessert = ["ice cream", "doughnut", "pie", "cookies"]
In this example, the words “flavour”, “bonus”, and “dessert” are all variables. A variable is the most basic building block in a program. Each one can be used to store a number, a word (also know as a “string”), or a list.
Become a subscriber and get access to the rest of this article. Plus all our magazine articles.
Stories also include numerous links to help parents, kids, and teachers learn more. Get access today at just $15 per year for online magazine only or $29.99/year for print + online ($35/year outside US)!
Also In The August 2018 Issue
Create a fun adventure game with sprites using a retro fantasy computer.
Hide information in plain sight using a clever code and a good book.
Logic puzzles help develop reasoning skills useful for programming, computer science, and anything you might do.
Find perfect and fun gifts for your loved ones that teach STEAM concepts and skills.
From light-up bow-ties to conductive thread, you’ll be the life of the party with this STEAM-inspired gear.
A free online test service reveals how much personal data your web browser is giving away.
Add more tools to your command line arsenal, including running mini-scripts and making backup copies.
Use switches to take your robotic creations to the next level.
Create the American flag in SketchUp using this detailed tutorial.
From lasers to supernovas, Berboucha is making science communication a priority.
Code can always be improved. Check out these tips to make you the best programmer you can be!
It’s a programming language unlike any you’ve seen before. Check out this symbolic system designed for mathematical calculations.
It’s a game that’s obsessing the world. Harmful, or a potential gateway to new skills?
Some fun Python code that introduces you to the arcane world of event handling.
New, improved, faster, and sleeker - it’s Scratch 3, your new favourite block language!
Learn about the brilliant algorithm behind all of your GPS devices.
It’s free, comprehensive, and available on-the-go. This cool app helps you master Python faster than ever before.
Open up whole new worlds to explore through these interesting, diverse add-ons.
Links from the bottom of all the October 2018 articles, collected in one place for you to print, share, or bookmark.
Interesting stories about computer science, software programming, and technology for October 2018.