A Few Things to Try

  • “99 Bottles of Beer on the Wall.” Write a program that prints out the lyrics to that beloved classic, “99 Bottles of Beer on the Wall.”

  • Deaf grandma. Whatever you say to Grandma (whatever you type in), she should respond with this:

    HUH?! SPEAK UP, SONNY!

    unless you shout it (type in all capitals). If you shout, she can hear you (or at least she thinks so) and yells back:

    NO, NOT SINCE 1938!

    To make your program really believable, have Grandma shout a different year each time, maybe any year at random between 1930 and 1950. (This part is optional and would be much easier if you read the section on Ruby’s random number generator here.) You can’t stop talking to Grandma until you shout BYE.

    Hint 1: Don’t forget about

Get Learn to Program, 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.