Welcome to Computer Programming For Kids (CP4K)

Welcome to the Computer Programming for Kids blog! We are the co-authors of the book "Hello World! Computer Programming for Kids and Other Beginners", released in March 2009. The book is published by Manning Publications. Manning has a web site for the book, which is where you can download the software and other files related to the book. You can purchase it here, at the Manning web site. If you use this link to purchase the print book or e-book from the Manning web site, you can use the discount code aupromo40 at checkout to get a 40% discount. You can also get it through online retailers like Amazon, as well as in many retail locations such as Chapters in Canada and Barnes & Noble in the U.S. This blog is mostly about the book (for now), but anything related to computers and programming, particularly for kids and beginners, is fair game. We will post articles with extra material that didn't make it into the book, and reader feedback and suggestions are always welcome.

Thursday, September 23, 2010

Cool stuff for Mac

Hey guys,

Recently, I got a Mac. This means I'll be able to help a lot more with Mac problems on our author forums and on this blog. In related news, here's a cool trick for Macs only. You can make your program talk to you! Start by importing os. OS is a module that lets you interact with your computer's operating system. Then, type the following:

os.system("say Hello World!")

This will send a command to Mac OS telling it to, well, say, "Hello World!" You can put whatever you want after say. However, apostrophes (') don't seem to work. If you have one in your string, it won't say anything at all. Here's an example program:

import os
os.system("say Whats your name?")
#For some reason, apostrophes don't work.

name = raw_input("What's your name?")
# It's good to put it on the screen as well,
# in case users don't have their speakers on.

print "Hi, "+name+", hows it going?"
os.system("say Hi, "+name+", hows it going?")

I hope this brings a whole new level of interaction to all your future programs!

Carter Sande


  1. My nine year old son is having trouble running a couple of the modules. He keeps getting error messages. He's very frustrated. Is there somewhere where he can get help or contact you? Please help. He's working really hard and checking that all the input is added correctly. Awaiting your response. Thank you.

  2. If you're having trouble, you can e-mail us at cp4khelp@yahoo.com or go to our author forum here .

  3. The os.system() function interacts with the internal system,on Mac OS X it interacts with the kernel(Darwin/UNIX) and the terminal(/applications/utilities)lets you interact easily

  4. is there any way that this can work on windows?
    email me at eliandkatie@acsalaska.net
    also... i'd like some help with PythonCard. Thanks!


Note: Only a member of this blog may post a comment.