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
Where can I learn how you hack?​
morpeh [17]

Answer:

www.udemy.com

5 0
3 years ago
Read 2 more answers
You can set the margin using the rular also true or false​
Murljashka [212]

Answer:

true

Explanation:

7 0
3 years ago
--------------communication involves one speaker andaudience.
dalvyx [7]

Answer:

Person-to-Group

Explanation:

Person-to-Group communication involves one speaker and audience.

6 0
3 years ago
HURRRRYYYY
Mandarinka [93]
An example of revolving credit is C
8 0
4 years ago
Read 2 more answers
Which methods can you use to migrate user settings from windows 8.1 to windows 10?
seropon [69]

Windows Easy Transfer is used  to migrate user settings from windows 8.1 to windows 10,.

<h3>What is Windows Easy Transfer?</h3>

Windows Easy Transfer exists as a specialized file transfer program developed by Microsoft that permits users of the Windows operating system to transfer personal files and locations from a computer running an earlier version of Windows to a computer running a newer version.

The Windows Easy Transfer utility can be utilized to back up data from a computer before completing an upgrade or clean install of the Windows 8 operating system and then restore the data to the computer after the Windows 8 operating system exists installed.

Hence, Use Windows Easy Transfer. Copy the user profile from the old computer to the new computer. Complete an upgrade over the top of the old operating system. utilize the User State Migration Toolkit.

To learn more about Windows Easy Transfer refer to:

https://brainly.in/question/2787534

#SPJ4

7 0
2 years ago
Other questions:
  • Which of the following sentences uses the correct verb tense?
    8·2 answers
  • Design a Geometry class with the following methods: A static method that accepts the radius of a circle and returns the area of
    15·1 answer
  • When you park on a hill, think about which way _____.
    6·2 answers
  • Who's YouTube creator?
    10·2 answers
  • 29 POINTS!!!
    6·1 answer
  • What do developers do to support software products?
    5·2 answers
  • What is the difference between - and % in mysql
    15·1 answer
  • Suppose testcircle1 and circle1 in listing 9.1 are in two separate files named testcircle1.java and circle1.java, respectively.
    14·1 answer
  • Ultraportable computers will often use ___ technology exclusively, even though their storage capacity is lower than that of a tr
    8·1 answer
  • The _____ describes how data actually moves from an application on one computer to an application on another networked computer.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!