Due Date: midnight, Friday, 26 October.

This assignment focuses on functions from Chapter 6.

Submit the following programs via Blackboard:

  1. (From Chapter 6, #1, Page 196) Write a program to print the lyrics of the song "Old MacDonald." Your program should print the lyrics for five different animals, similar to the example verse below.
    	   Old MacDonald had a farm, Ei-igh, Ee-igh, Oh!
    	   And on that farm he had a cow, Ee-igh, Ee-igh, Oh!
    	   Whith a moo, moo here and a moo, moo there.
    	   Here a moo, there a moo, everywhere a moo, moo.
    	   Old MacDonald had a farm, Ei-igh, Ee-igh, Oh!
    	
    (Hint: use a function with two input parameters one for the animal and the other for the related sound)

  2. Write a function that takes as a parameter a list of strings and returns a list containing the first letter of each of the strings.
    That is, if the input parameter is ["Daniel","Nashyl","Orla","Simone","Zakaria"], your function should return ["D", "N", "O", "S", "Z"]. The file you submit should include a main() function that demonstrates that your function works.

  3. Modify the program from Lab 7 to allow the user to enter two different mathematical functions to be graphed. Your program should then display both on in the graphics window.

  4. Fill in the missing function definitions for this program:
             def main():
                welcome()              #Prints "Hello, world" to the screen 
                x,y = userInput()      #Asks user for 2 inputs and returns numbers entered
                d = calculate(x,y)     #Returns the difference of the parameters
                displayResults(x,y,d)  #Prints the two inputs, and d
     
             main()
          
    That is, write the functions welcome(), userInput(), calculate() and displayResults(). Include all functions, including the main() above in the file you submit.

  5. Write a function that takes as a parameter a list of strings and returns a list containing the lengths of each of the strings. That is, if the input parameter is ["Daniel","Nashyl","Orla", "Simone","Zakaria"], your function should return [6, 6, 4, 6, 7]. The file you submit should include a main() function that demonstrates that your function works.
For more information on using Blackboard, see the first lab.

General Notes