Join the QuestionCove community and study together with friends!
Sign Up
jayfafr:
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-O
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-O
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.
TheKaylaHope:
@Dude @Vocaloid @ultrilliam @shadow
California:
@jayfafr wrote:
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-O
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-O
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.
Where is the coding
California:
What language is it in?
jayfafr:
@california wrote:
What language is it in?
idk what it is in but this is what i have animal = input("Enter an animal: ")
sound = input("Enter a sound: ")
e = "E"
print("Old Macdonald had a farm," + e)
print("And on his farm he had a" + sound + "," + e)
print("With a " + animal + " - " + animal + " here and a" + sound + "-" + sound + " there")
print("Here a "+ sound + "there a" +sound)
print("Everywhere a" + animal + "- " + sound)
print("Old Macdonald had a farm ," + e)
Still Need Help?
Join the QuestionCove community and study together with friends!
Join the QuestionCove community and study together with friends!
Sign Up
California:
alr i got it.
California:
So, what the words they give you are (pig) and (oink). they practically already have the code written out for you though. It should be
animal=input("text")
sound=input("text)
e="e"
print("text"+e)
print("text"+sound+"text"+e)
and so on
California:
however. I did happen to show you how to do it. I didn't directly give you the answer because, I explained it to you so you may understand it better.