Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Raspberry Pi Projects for Kids (Second Edition)
  • Table Of Contents Toc
Raspberry Pi Projects for Kids (Second Edition)

Raspberry Pi Projects for Kids (Second Edition)

By : Daniel Leonard Bates
4.4 (5)
close
close
Raspberry Pi Projects for Kids (Second Edition)

Raspberry Pi Projects for Kids (Second Edition)

4.4 (5)
By: Daniel Leonard Bates

Overview of this book

This book is for kids who wish to develop games and applications using the Raspberry Pi. No prior experience in programming is necessary; you need only a Raspberry Pi and the required peripherals.
Table of Contents (9 chapters)
close
close

Making mischief

So, we have random phrases being displayed, but what if we now want to make them less random? What if you want to show your program to a friend, but make sure that it only ever says nice things about you, or bad things about them? In this section, we'll extend the program to do just that.

Dictionaries

The first thing we're going to do is replace one of our lists with a dictionary. A dictionary in Python uses one piece of information (a number, some text, or almost anything else) to search for another. This is a lot like the dictionaries you might be used to, where you use a word to search for its meaning. In Python, we say that we use a key to look for a value.

We're going to turn our adjectives list into a dictionary. The keys will be the existing descriptive words, and the values will be tags that tell us what sort of descriptive words they are. Each adjective will be "good" or "bad".

My adjectives list becomes the following dictionary. Make...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Raspberry Pi Projects for Kids (Second Edition)
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon