Heh heh. I crack myself up.
My sister Keren sent us an awesome care package! (Get it? I like to over-explain my obvious, mildly amusing jokes.) It was filled with absolutely delightful things. Jack Daniel’s Old No. 7 mustard, Sierra Nevada Stout & Stoneground Mustard, a sweet little tape measure that will live in my bag (for all the impromptu measuring I do), two c-clamps so adorably tiny I want Lloyd to wear them like cufflinks, and best of all – a singing frog.
All the things were met with glee as they were removed from the box, but the funniest was the frog. I just thought it was a stuffed animal, but it had a puppet slot in the back, and inside the mouth is a sound chip. It sings “Are you sleeping?” “Old MacDonald” and “London Bridge”. I started to croak the songs for Lloyd and he said, “You’ll never guess what tomorrow’s assignment is in programming. They have to write a program that sings Old MacDonald.” He took it to school for a good intro to the assignment.
Here’s the puppet master in his own words:
—-
Well, maybe “sing” is too strong a word. It has to ask the user (rhymes with loser) to enter an animal and the sound that the animal makes. Then the program should print out the words to Old McDonald. It’s our second program of the season.
—-
Lloyd, that is not a good story. It says nothing about the puppet. Tell us how you used the puppet! Um – where’d he go? He’s gone, and probably embarrassed about his awesome puppetry skilz.
Thank you, Keren – you sent a whole box of smiles our way!
Brad says
Q: What did the frog order at McDonald’s?
A: French flies and a diet croak.
Kristi says
Q: Know why frogs are happy?
A: They eat what bugs them.
Peggy says
Lauren, you have such a Keren’ sister!! How very cool to get such a fun package!!
What is red & green & goes a thousand miles an hour?
A frog in a blender.
Deanne says
Can I leave a comment if it’s not a frog riddle?
Just in case:
Q: What happens if a frog parks in a bus stop?
A: He gets toad away!
Steve Lokie says
The program will eventually look like this:
#OldMcdonald.py
#Steve Lokie
#Created: November 25th, 2008
#Last Modified: --, 2008
#
#This program prints the song
#”Old Mcdonald”
#
from time import sleep
from MyModule import get_integer, article
def main():
print_instructions()
prompt = get_integer(“How many verses would you like to sing? “)
for prompt in range(prompt):
animal,sound = get_info()
print
print”~~~~~~~~ Verse “+str(prompt+1)+” ~~~~~~~~”
print_verse(animal,sound)
print “That was fun, lets do it again sometime.”
def print_instructions():
print \
“””
========================================================
Old McDonald
========================================================
Instructions
************
This program plays the song “Old McDonald”, but here’s
the best part… you get to choose how many verses it
plays, and the animal, and animal noise it sings! How
great is that? All you have to do is enter how many
verses you would like to play, the animal, and it’s
noise. O and don’t forget… SING ALONG!
========================================================
“””
def sing_line(line,howLong):
“””prints the song line and delays the next”””
print line
sleep(howLong)
def get_info():
“””gets the animal and its sound from the user”””
print”========================================================”
animal = raw_input(“Give me an animal? “)
sound = raw_input(“What sound does this animal make? “)
print”========================================================”
return animal,sound
def print_verse(animal,sound):
“””prints the verse”””
animalArticle = article(animal)
soundArticle = article(sound)
sing_line(“Old McDonald had a farm”,0.5)
sing_line(“E I E I O”,1.0)
sing_line(“And on that farm he had “+animalArticle+” “+animal+””,0.5)
sing_line(“E I E I O”,1.0)
sing_line(“With “+soundArticle+” “+sound+” “+sound+” here,”,0.5)
sing_line(“and “+soundArticle+” “+sound+” “+sound+” there”,0.5)
sing_line(“Here “+soundArticle+” “+sound+”,”,0.5)
sing_line(“there “+soundArticle+” “+sound+”,”,0.5)
sing_line(“everywhere “+soundArticle+” “+sound+” “+sound+””,1.0)
sing_line(“Old McDonald had a farm”,1.0)
sing_line(“E I E I O”,0.5)
sing_line(“~~~~~~~~~~~~~~~~~~~~~~~~~”,1.0)
print
def article(word):
“””return a or an based on the word given”””
firstChar = word[0]
if firstChar in ‘aeiouAEIOU’:
thisArticle = ‘an’
else:
thisArticle = ‘a’
return thisArticle
def get_integer(question):
“””asks the user for an integer and returns it”””
answer = raw_input(question)
while not is_integer(answer):
print answer+” is not an integer”
answer = raw_input(question)
integerAnswer = int(answer)
return integerAnswer
def is_integer(string):
“””looks at a string and returns True if that string is an integer”””
isInteger = True
for character in string:
if character not in ‘0123456789’:
isInteger = False
return isInteger
main()
By the way Mr. Sommerer, I think since I am no longer your student I should be able to call you Lloyd, or at least Sloyd
Lauren says
Awesome. Now future students can just copy-and-paste their way to success. 😉
Lloyd says
Mr. Roeber’s rule is that you can call him John after you buy him a beer.
Christina says
So what is Mr. Sommerer’s rule??? You can call him Lloyd after you chase cows for 20 years?
Lloyd says
I used to say, “I would be honored if you called my Lloyd, after you graduate”, like Mr. Engelbrecht did. Except he didn’t say, “Lloyd.” But Mr. Roeber’s rule seems so very compelling.
Steve Lokie says
Does that mean I have to buy you a beer?