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
Question 7 Consider the following code:
zhannawk [14.2K]

Answer:

Melon

Explanation:

The variable "list" containts a function that returns a price that is greater than or equal to 60.0.

In the variable "fruit", the only item in the array with a price attribute set above that number is the string Melon.

3 0
1 year ago
By Carl Sandburg
Eva8 [605]
The answer is 1 because the poet uses personification.
6 0
3 years ago
____ is a technique for confirming that q received packet or frame is likely to match what was sent
hammer [34]

Answer:

C. Error checking

Explanation:

I hope this helps

6 0
2 years ago
A command, such as a button or keyboard shortcut, that performs a specific task is known as a
Oxana [17]

Answer:

Macro

Explanation:

7 0
3 years ago
Read 2 more answers
Two-factor authentication can best be breached by the adversary using:________. a. social engineering attack b. using sniffers l
tiny-mole [99]

Answer:

a. social engineering attack

Explanation:

Two-factor authentication requires that the user/owner of the account enter a second verification code alongside their password in order to access the account. This code is usually sent to a personal phone number or email address. Therefore in order to breach such a security measure the best options is a social engineering attack. These are attacks that are accomplished through human interactions, using psychological manipulation in order to trick the victim into making a mistake or giving away that private information such as the verification code or access to the private email.

6 0
3 years ago
Other questions:
  • Writenames of eight output device.​
    8·1 answer
  • If you wanted to create a graph that showed how much each value contributed to the whole value, you would use a _____.
    15·2 answers
  • Consider a movie database in which data is recorded about the movie industry. the data requirements are summarized as follows:
    15·1 answer
  • What is the approximate area of the figure? A. 129 square inches B. 113 square inches C. 110 square inches D. 44 square inches
    15·1 answer
  • The user can set their own computer hostname and username. Which stage of the hardware lifecycle does this scenario belong to?
    6·1 answer
  • (Convert milliseconds to hours, minutes, and seconds) Write a function that converts milliseconds to hours, minutes, and seconds
    12·1 answer
  • A program that doesn’t work properly needs to be debugged. true or false
    8·1 answer
  • In what situations might you need to use a function that calls another function?
    11·1 answer
  • The __Option carries out the commands one at a time. O Step-by-Step Run Command Open Command​
    9·1 answer
  • Which type of internet connection allows for high-speed bi-directional data communication over a hybrid fiber-coaxial (HFC) conn
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!