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
You can use tables for layout work. However, in XHTML, each form control should have its own ______ element
777dan777 [17]

Answer:

c. label

Explanation:

4 0
3 years ago
A professional bureaucracy is a knowledge-based organization where goods and services depend on the expertise and knowledge of p
PtichkaEL [24]

Answer:

True

Explanation:

<em>Professional bureaucracy</em> is considered as a combination of professionals withing a government or private organization, these professionals are relied on to achieve productivity and are involved in making major decisions or implementing major regulations that decide the future of the organization.

In other words, professional bureaucracy grants employed professionals flexibility in carrying out their responsibilities in the organization, i.e., greater control of their duties.

6 0
3 years ago
Which symbol is used for an assignment statement in a flowchart?
Pavlova-9 [17]

Equal symbol

equal symbol

Within most programming languages the symbol used for assignment is the equal symbol.

4 0
3 years ago
The best presentations try to include as much text as possible on each slide true or false ​
Zina [86]
True is answered of that question
5 0
3 years ago
You are installing several servers that will be used as web servers to reach customers over the Internet. Where should you place
just olya [345]

Answer: DMZ

Explanation:

 DMZ is the demilitarized zone network and it is use in providing he various services to the users or customers by using the public internet. It basically contain organizational services in the logical and physical sub-network and usually works in large network.

The main purpose of DMZ that it is use as web server over the internet for reaching to the users and customers. It also add one additional layer in the organization for security purpose.

Some of the services that DMZ provides as web server, DNS and proxy server.  

4 0
3 years ago
Other questions:
  • Ryan is looking at investment opportunities as a cloud service provider. He wants to invest in a deployment-based cloud model th
    11·2 answers
  • Reggie has hired you to design a home network. The home network will share a printer but will mainly be used to stream movies to
    7·1 answer
  • A _____ is a unique name that identifies an Internet site. URL Browser AOL IA
    13·1 answer
  • Set methods are also commonly called _____ methods, and get methods are also commonly called _____ methods.
    6·1 answer
  • Hi, I just have a few questions from my digital tech assignment.
    14·2 answers
  • What is the difference between the Internet and the World Wide Web? Explain in your own words.
    13·2 answers
  • Identify the following​
    9·1 answer
  • g Which of the following factors primarily determines how the Internet is used in different countries? A. local attitude to info
    6·1 answer
  • Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input
    5·1 answer
  • I WILL MARK BRAINLEST
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!