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
Which name is given to an architectural framework for delivering ip multimedia services?
jonny [76]
IP Multimedia Subsystem<span> or </span>IP Multimedia<span> Core Network </span>Subsystem<span> (</span>IMS) is the term that refers and describes<span> an architectural framework for delivering IP multimedia services.
</span>IMS is a standards-based architectural framework <span> defined by the 3rd Generation Partnership Project (3GPP) </span>for delivering multimedia<span> communications </span>services such as voice, video and text .
6 0
3 years ago
1) ( IBADE - 2020)A legislação que regula o uso da Internet no Brasil por meio da previsão de princípios, garantias, direitos e
VARVARA [1.3K]
C) Lei da Regulação Digital :)
6 0
2 years ago
How to play Drinkopoly game?
professor190 [17]
Answer:
Never heard of that lol
3 0
2 years ago
Is technology a legal discipline or law is a technological artifact.
ANEK [815]

Answer:Technology law scholars have recently started to consider the theories of affordance and technological mediation, imported from the fields of psychology, human-computer interaction (HCI), and science and technology studies (STS). These theories have been used both as a means of explaining how the law has developed, and more recently in attempts to cast the law per se as an affordance. This exploratory paper summarises the two theories, before considering these applications from a critical perspective, noting certain deficiencies with respect to potential normative application and definitional clarity, respectively. It then posits that in applying them in the legal context we should seek to retain the relational user-artefact structure around which they were originally conceived, with the law cast as the user of the artefact, from which it seeks certain features or outcomes. This approach is effective for three reasons. Firstly, it acknowledges the power imbalance between law and architecture, where the former is manifestly subject to the decisions, made by designers, which mediate and transform the substance of the legal norms they instantiate in technological artefacts. Secondly, from an analytical perspective, it can help avoid some of the conceptual and definitional problems evident in the nascent legal literature on affordance. Lastly, approaching designers on their own terms can foster better critical evaluation of their activities during the design process, potentially leading to more effective ‘compliance by design’ where the course of the law’s mediation by technological artefacts can be better anticipated and guided by legislators, regulators, and legal practitioners.

Keywords

Affordance, technological mediation, postphenomenology, legal theory, compliance by design, legal design

7 0
2 years ago
What are the five types of pointing devices?
choli [55]

Answer:

mouse, track ball, stick, touch pad, tablet

6 0
2 years ago
Other questions:
  • Blogs are typically written by large companies or organizations as a way to express formal, technical, or scholarly information
    5·2 answers
  • Kuta software infinite pre- algebra multiplying polynomial and a monomial find product answer key
    14·1 answer
  • Original Problem statement from the Text: A retail company must file a monthly sales tax report listing the sales for the month
    7·1 answer
  • With the ease of the Internet, it is not uncommon for individuals to copy skills from resume templates to make themselves look m
    9·1 answer
  • Part 1 Given 3 integers, output their average and their product, using integer arithmetic. Ex: If the input is 10 20 5, the outp
    6·1 answer
  • What is a protein called if it loses its shape?
    8·1 answer
  • A=1/2h(a+b) solve for h
    6·1 answer
  • Por favor alguem poderia me falar qual PC e melhor: Computador Gamer Fox PC FPS Intel Core i5 8GB (GeForce GTX 1050Ti 4GB GDDR5)
    15·1 answer
  • What will the following code display? int numbers[4] = { 99, 87 }; cout &lt;&lt; numbers[3] &lt;&lt; endl; a. 87 b.0 d. 34. What
    12·1 answer
  • Please help I will mark brainliest ⚡️⚡️⚡️⚡️
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!