Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 22462

Python 4 Kids: Python for Kids Book: Project 8

$
0
0

In these posts I outline the contents of each project in my book Python For Kids For Dummies.  If you have questions or comments about the project listed in the title post them here. Any improvements will also be listed here.

What’s in Project 8 (Silly Sentences)

Project 8 is a short project which teaches you about (old style) formatting strings. Formatting strings allow you to create a sentence template into which you can substitute words.  Four words are chosen from four lists (at random) and substituted into a sentence. The random matchings make nonsense sentences. The substitutions can be streamlined by using a data type called the tuple, so that data type is introduced and discussed. You learn how to unpack tuples and how to use a tuple to receive multiple values from a function.  The project also relies on the random.choice method.



Viewing all articles
Browse latest Browse all 22462

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>