Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Projects for Kids

You're reading from   Python Projects for Kids Unleash Python and take your small readers on an adventurous ride through the world of programming

Arrow left icon
Product type Paperback
Published in Apr 2016
Publisher Packt
ISBN-13 9781782175063
Length 192 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jessica Ingrassellino Jessica Ingrassellino
Author Profile Icon Jessica Ingrassellino
Jessica Ingrassellino
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Welcome! Let's Get Started 2. Variables, Functions, and Users FREE CHAPTER 3. Calculate This! 4. Making Decisions – Python Control Flows 5. Loops and Logic 6. Working with Data – Lists and Dictionaries 7. What's in Your Backpack? 8. pygame 9. Tiny Tennis 10. Keep Coding! A. Quick Task Answers Index

Testing your code so far


You have now written all of the data storage elements of the game. Save your code again if you have not done so already, and test what you have written.

First, do a visual test of your backpack.py code file. Make sure that your code is indented properly. Look for syntax errors such as misplaced quotes, periods, square brackets, curly braces, and parentheses. Make sure that everything is spelled correctly. Save after each mistake that you fix.

Next, use your command prompt (Windows) or terminal (Mac/Linux) to test your code by running your program. When you run your program, you should expect to be asked to enter the name of player 1, enter four items, enter the name of player 2, and enter four more items:

If you want to make sure that the backpack items you enter are being properly stored, you can use the test code from line 20 in the screenshot. Just uncomment (erase the hashtag in front of) the code in line 20, and then run the code again. Use the print statement...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime