In your Code Editor, there is some code meant to output verses of the song "Old MacDonald had a farm. "


When the code is working properly, if the user types in pig for an animal (when prompted to "Enter an animal: ") and oink for the sound


(when prompted to "Enter a sound: "), the program should output the following as it runs:


Old Macdonald had a farm, E-I-E-I-0


And on his farm he had a pig, E-I-E-I-O


with a oink-oink here and a oink-oink there


Here a oink there a oink


Everywhere a oink-oink


old Macdonald had a farm, E-I-E-I-0


There are a few errors in the code provided in the Code Editor. Your task is to debug the code so that it outputs the verses correctly.


Hints:


Try running the code and looking closely at what is output. The output can be a clue as to where you will need to make changes in


the code you are trying to debug.
. Check the variable assignments carefully to make sure that each variable is called correctly.


Look at the spacing at the end of strings - does each string have the appropriate number of spaces after it?



Answer :

Other Questions