9781119046028-co0101.tif

PROGRAMMING WITH SCRATCH can be a lot of fun, but as you become more skillful at creating games and graphics using this application, you may notice that there are limits to what you can achieve with Scratch. Most computer programmers use text-based languages to create computer programs, including games, desktop applications and mobile apps. Although text-based programming may seem more complicated at first, you will soon find that it is easier to achieve your goals by using code. The Python code language is used by millions of programmers worldwide, including developers at organisations like NASA, Google and CERN.

In this adventure, you’ll discover what you need in order to set up Python on your Raspberry Pi. You’ll write a short program, and learn to use a text editor. After that, you’ll delve deeper into Python, learning about modules and their applications, how to get user input and how to use conditionals. Finally, you’ll put all your new knowledge to use, creating a text-based adventure game in which your user (player) will answer questions and your game will respond based on the answers.

Although this may seem like a major departure from the graphical world of Scratch programming, the good news is that all of the programming concepts you learned in Scratch apply to other languages as well, even those that seem very different. Concepts such as using a sequence of instructions ...

Get Adventures in Raspberry Pi, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.