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
jenyasd209 [6]
3 years ago
11

Done through Block Py/ Python

Computers and Technology
1 answer:
34kurt3 years ago
3 0

Answer:

Following are the code to this question:

def rate_animal(an_animal):#defining method rate_animal

   if an_animal=="cat":#defining if block to check valu

       return 1 #return value 1

   elif an_animal=="dog":# defining elif block to check another value

       return 2 #return value 2

   elif an_animal=="capybara":# defining elif block to check another value

       return 3 #return value 3

   elif an_animal=="danger noodle":# defining elif block to check another value

       return 4 #return value 4

   else:

       return -1 #return value -1

print("dog Rating: ",rate_animal("dog"))#calling method and print its return value

print("cat Rating: ",rate_animal("cat"))#calling method and print its return value

print("capybara Rating: ",rate_animal("capybara"))#calling method and print its return value

print("danger noodle Rating: ",rate_animal("danger noodle"))#calling method and print its return value

print("Horse Rating: ",rate_animal("horse"))#calling method and print its return value

Output:

dog Rating:  2

cat Rating:  1

capybara Rating:  3

danger noodle Rating:  4

Horse Rating:  -1

Explanation:

Description of the python code can be defined as follows:

  • In the above program code, a method "rate_animal" is declared, in which a string variable "an_animal" passes as the argument, inside the method, multiple conditional statements are used.
  • In the if the block, it will check string value if it equal to "cat", it will return 1, otherwise, it will go to elif block, in this block it will check value is  "dog", "capybara", and "danger noodle", if the value is any of then it will return 2, 3, and 4.
  • If the above condition is not true, it will return a value, that is "-1", in the next step print method is used, that calls the method and print its return value.
You might be interested in
Which shape denotes a process to be carried out in a flowchart?
luda_lava [24]

The answer is a rectangle.

6 0
2 years ago
Read 2 more answers
The ________ simulates your work area.
xz_007 [3.2K]
I believe it is, A. taskbar
5 0
2 years ago
Three reasons why users attach speakers to their computers.
ZanzabumX [31]

Answer:

Iv'e answered this question 2 times already lol. The purpose of speakers is to produce audio output that can be heard by the listener. Speakers are transducers that convert electromagnetic waves into sound waves. The speakers receive audio input from a device such as a computer or an audio receiver.

Explanation: I hope this helps!

8 0
3 years ago
i'm actually really smart so if u need help just ask me or leave me a comment. im 16 and my name is lexi
kicyunya [14]
Umm okay...

The density of water is 1.0 g/cm^3
Which will float in water

A.) Ice (Density = 0.92 g/cm^3) Float or sink

B.) Wood (Density = 0.45 g/cm^3) Float or sink

C.) Bone (Density = 1.7 g/cm^3) Float or sink

If you help answer this it will be much appreciated thank you
8 0
3 years ago
Read 2 more answers
Which sentence describes a task on which a genetic engineer is most likely to work?
galina1969 [7]

Answer:

C

Explanation:

If you look at the picture, you will see why it is C. It says D, but the multiple choices are differently ordered and it is kind of differently worded.

But in conclusion, the answer is C.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is the best definition of a workplace policy?
    13·2 answers
  • When does the VB.NET programming environment start to operate?
    10·1 answer
  • Select the correct answer.
    8·1 answer
  • 1. Why was the Internet created?
    8·1 answer
  • True or False: It is illegal to park in a location that you block or create a hazard for other vehicles.
    11·2 answers
  • I Just Realized................
    7·2 answers
  • Big Project, Giving 5 stars, a Thanks, 80 points, and Branliest to whoever answers them correctly
    9·2 answers
  • What would a digitizing application create?
    13·2 answers
  • Describe the scope of the variables in this code.
    8·2 answers
  • 1. Write the full forms of the following.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!