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
Reading for subject content follows the same steps as reading for entertainment. True or false.
marshall27 [118]

The answer is false.  There is a difference between reading for entertainment or leisure and reading for subject content.  In the latter, you have to scan what you are reading carefully.  There are keywords and sentences that you have to watch out for to get the whole idea of the document that you are reading.

5 0
3 years ago
Read 2 more answers
The process of arranging the item of a column in some sequence or order is known as?
MatroZZZ [7]

answer: sorting??  

(hope it helps)

6 0
2 years ago
Part 2: a) Write VHDL code for a top module that invokes necessary components to display the four decimal digits on four seven-s
dimulka [17.4K]
I don’t know ‍♀️ sorry
7 0
2 years ago
You are going to do a bubble sort on the following list. What are the missing members of the list? Select 3 options.
Nadya [2.5K]
The bubble sort makes multiple passes through a list. It compares adjacent items and exchanges those that are out of order. Each pass through the list places the next largest value in its proper place. In essence, each item “bubbles” up to the location where it belongs.
4 0
3 years ago
Read 2 more answers
The PRNG variable ___________ is defined in NIST SP 800-90 as a number associated with the amount of work required to break a cr
Kamila [148]

Answer:

Strength

Explanation:

A huge number of systems use a process called Pseudo Random Number Generation (PRNG). In NIST SP 800-90, The PRNG has a set of parameters that define various variables within the algorithm. The PRNG variable strength is defined in NIST SP 800-90 as a number associated with the amount of work required to break a cryptographic algorithm or system.

3 0
3 years ago
Other questions:
  • when seeking information on the on the internet about a variety of subjects the most useful place to look would be?
    13·1 answer
  • The computer mouse is used to
    11·1 answer
  • A hierarchical topology is also called a _____ topology.
    9·1 answer
  • Page UND
    8·1 answer
  • What is hydraulic fracturing?
    7·1 answer
  • To enter new code that performs as intended in the place of the old code that produces an error is the goal of
    9·1 answer
  • Good ways to increase sales on phone accesories?
    10·2 answers
  • Que es un vlog? Cual es la diferencia entre vloc y papgina web? ​
    7·1 answer
  • You wrote a program to compare the portion of drivers who were on the phone. Which statements are true? Select 4 options.
    12·1 answer
  • the human resources department requests a list that contains the number (i.e. count) of orders taken on each date, grouped by th
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!