1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
shepuryov [24]
11 months ago
6

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:.
Computers and Technology
1 answer:
iris [78.8K]11 months ago
5 0

Using the knowledge in computational language in python it is possible to write a code that  meant to output verses of the song "old macdonald had a farm.

<h3>Writting the code:</h3>

def main():

   # Make a list containing animals and sounds.

   #     Element n is the animal and n+1 is its sound.

   animals = ['cow', 'moo', 'chicken', 'cluck', 'dog', 'woof', 'horse', 'whinnie', 'goat', 'blaaah']

   # For each animal/sound pair

   for idx in range(0, len(animals), 2):

       # Call song(), passing the animal/sound pair as parameters.

       song(animals[idx], animals[idx+1])

       print()

# song():

#   animal and sound are arguments

def song(animal, sound):

   # Call firstLast() for first line of song

   firstLast()

   # Call middleThree() for middle three lines, passing animal and sound

   middleThree(animal, sound)

   # Call firstLast() for last line of song

   firstLast()

# firstLast():

def firstLast():

   # Print "Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!"

   print("Old MacDonald had a farm, Ee-igh, Ee-igh, Oh!")

# middleThree():

#   animal and sound are arguments

def middleThree(animal, sound):

   # Print middle three lines of song with passed animal and sound.

   print('And on that farm he had a {0}, Ee-igh, Ee-igh, Oh!'.format(animal))

   print('With a {0}, {0} here and a {0}, {0} there.'.format(sound))

   print('Here a {0}, there a {0}, everywhere a {0}, {0}.'.format(sound))

main()

See more about python at  brainly.com/question/18502436

#SPJ1

You might be interested in
When microsoft introduced its zune mp3 player, many people thought it would capture the mp3 player market by pricing its product
SSSSS [86.1K]
Your answer would be:  P<span>redatory Pricing .</span>
8 0
3 years ago
If I want to add a new slide to my presentation, which option would I click on?
ivanzaharov [21]
The answer would be D. New Slide
3 0
2 years ago
11.
dsp73
11. <span><span>their population crashed.
</span><span>
12. </span></span><span>dead zone

13. I believe </span><span>energy efficient</span>
4 0
3 years ago
Read 2 more answers
Your task is to identify three or more ways that big data is being collected on a regular basis, including one data collection m
attashe74 [19]

Answer:

Data is one of the most valuable resources today's businesses have. ... There are various data-gathering methods you can use with the help of your ... When it comes to data businesses collect about their customers, ... Third-party data offers much more scale than any other type of data, ... Big White Cursor.

Explanation:

4 0
3 years ago
Tor F: Deleting cell data is the same as clearing the contents of a cell.
Valentin [98]

Answer:

no it is not

Explanation:

it's not because of the cells in side the chip for the data that comes from the cell phone

4 0
3 years ago
Other questions:
  • Which software application should be used to create a sales pitch to a group of people? Database Email Presentation Word process
    9·1 answer
  • Assume that there is a class called BankAccountHolder that represents an individual member of a bank. There is also a BankAccoun
    5·2 answers
  • Nikolas has a idea that he could use the compressed carbon dioxide in a fire extinguisher to propel him on his skateboard. Nikol
    13·2 answers
  • The Internet is considered a WAN. *<br><br> True<br> False
    9·1 answer
  • Should a waiting thread receive priority over a thread first attempting to enter a monitor? What priority scheme, if any, should
    9·1 answer
  • True or False? Using your traffic analytics report, you can see the source of traffic to your website
    13·1 answer
  • Explain the following buttons as used in emails:compose,inbox and Draft.<br>​
    10·1 answer
  • with the current computer development, explain 5th areas where computer is applied for the social economic dwvelopment in societ
    11·1 answer
  • There are some games that cannot be described by a single--or even two-- genres. Can you think of any that should be invented?​
    6·1 answer
  • Wight an essay on Knowledge sharing among robots.<br> please and please do not delete my question.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!