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]
10 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]10 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
Effective communication and critical thinking are examples of
lawyer [7]
The best and most correct answer among the choices provided by the question is the second choice. <span>Effective communication and critical thinking are examples of values. </span>I hope my answer has come to your help. God bless and have a nice day ahead!
3 0
3 years ago
You are a cleared employee. You discovered fraud and waste of money related to a classified program within your agency. If you r
Irina-Kira [14]

Answer:

A. True.

Explanation:

In this scenario, you are a cleared employee. You discovered fraud and waste of money related to a classified program within your agency. If you report this fraud and waste through appropriate channels, you may receive protection under the Presidential Policy Directive 19 (PPD-19): Protecting Whistleblowers with Access to Classified Information.

In USA, the Presidential Policy Directive 19 (PPD-19) which was signed by President Barack Obama in October 2012, is an executive order designed to provide significant protection for an employee who have access to classified informations such as fraud, waste of money and abuse or prohibiting any form of retaliation against this cleared employee.

3 0
3 years ago
How do cameras work? Explain in 2-3 sentences.
FinnZ [79.3K]

Answer:

In a digital camera, exactly the opposite happens. Light from the thing you are photographing zooms into the camera lens. This incoming "picture" hits the image sensor chip, which breaks it up into millions of pixels. The sensor measures the color and brightness of each pixel and stores it as a number.

Explanation:

3 0
2 years ago
2. You are developing a new application that optimizes the processing of a warehouse’s operations. When the products arrive, the
KonstantinChe [14]

Answer:

Option d) is correct

Explanation:

To optimize the processing of a warehouse’s operations, products are stored on warehouse racks when they arrive. The items that arrive last are the first to go out to minimize the time it takes to retrieve an item. The items that arrive need to be represented and the warehouse should be left in a data structure. The data structure which should you use to represent this situation is a queue.

Option d) is correct

5 0
2 years ago
A specialized storage device or group of storage devices that provides centralized fault-tolerant data storage for a network____
gogolik [260]

Answer: NAS(Network-attached storage)

Explanation:

NAS(Network-attached storage) is the file storage in computer server which links to computer network. It is used by heterogeneous client or group of other various users to access files data.

  • It can retrieve data from shared folder storage in network.It can provide serving file feature through standard, hardware,configuration or  software.
  • It provides high speed service of sharing and serving files, continuous work in faulty situation, easy configuration, simple accessing of data etc.

5 0
3 years ago
Other questions:
  • Which information is considered free for use?
    9·2 answers
  • When you are given a set of tables and asked to create a database to store their data, the first step is to ________?
    8·1 answer
  • Nathan wants to create multiple worksheet containing common formatting styles for his team members. Which file extension helps h
    9·1 answer
  • Write a program that reads students’ names followed by their test scores. The program should output each student’s name followed
    13·1 answer
  • What is the purpose of a primary key?
    5·1 answer
  • What is wrong with question four? Find the error and then correct it
    11·1 answer
  • Create a macro named mReadInt that reads a 16- or 32-bit signed integer from standard input and returns the value in an argument
    5·1 answer
  • Omo help me i need it now.
    12·1 answer
  • Write two example use of relationships ICT
    11·1 answer
  • The Clean Air Act Amendments of 1990 prohibit service-related releases of all ____________. A) GasB) OzoneC) MercuryD) Refrigera
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!