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
avanturin [10]
3 years ago
15

Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than

4, print "Too many.". Else, print "N : Lather and rinse." num_cycles times, where N is the cycle number, followed by "Done.".
Computers and Technology
1 answer:
EastWind [94]3 years ago
6 0

Answer:

Following are the code to the given question:

def shampoo_instructions(num_cycles):#defining a method shampoo_instructions that accepts num_cycles as a parameter

   if num_cycles < 1:#defining an if block that num_cycles value is less than 1

       print('Too few.')#print message  

   elif num_cycles > 4:#defining elif block that checks num_cycles is greater than 4

       print('Too many.')#print message  

   else:#defining else block

       N= 1;#defining N variable that holds a value 1

       for N in range(N, num_cycles+1):#defining for loop that check value in range

           print(N , ": Lather and rinse.")#print message  

       print('Done.')#print message  

shampoo_instructions(2)#calling the method

Output:

1 : Lather and rinse.

2 : Lather and rinse.

Done.

Explanation:

In this code, a method "shampoo_instructions" is defined, that accepts a variable "num_cycles" in its parameter, and in the next step, the multiple conditional statements have used that check the "num_cycles" values which can be defined as follows:

  • The if the block checks the parameter value is less than 1, and it prints the value as the message.
  • In the next step, the elif block is used that checks parameter value is greater than 4, and it prints the value as the message.
  • In the else block, it uses the for loop that checks the value in the range and prints its value and calling the method.
You might be interested in
Ang Kabihasnang ito ay umusbong sa rehiyon ng Timog Mexico
Westkost [7]

Answer:

nahh I'm still in disbelieve

8 0
3 years ago
I have been trying for 2 days to make an account, but it says registration cannot be completed at this time. It is extremely ann
Lady_Fox [76]

Answer: Ok what kind account are you trying to make if you need a account i can make one for you here is my hangout email . So i can give you the info to the account i made for you.

6 0
3 years ago
Read 2 more answers
How to change default search engine in internet explorer 10?
ser-zykov [4K]
Settings > view advanced settings > change search engine > Google search > set as default
7 0
3 years ago
Which of these can be considered data?<br> A:facts<br> B:information<br> C:belief<br> D:all of these
IceJOKER [234]

A) facts.

Facts is the only thing that can be considered REAL data.

6 0
3 years ago
What is windows powershell? I downloaded a fake video game on my PC.(It was an accident) Now, powershell is bugging me. Is it a
IrinaVladis [17]

Answer:

The PowerShell is a kind of shell framework, which was being developed by Microsoft for covering various administrative tasks like the configuration automation and management of certain repetitive jobs. And the term 'PowerShell' does refer to both of these- and its the shell applied for executing commands, and scripting language.

And yes, you have been infected by the virus. You need to run the antivirus immediately.

Explanation:

Please check the answer section.

5 0
4 years ago
Read 2 more answers
Other questions:
  • Assume the following rules of associativity and precedence for expressions:
    7·1 answer
  • It is essential that a security professional is able to resolve and respond to cyber law inquiries and incidents while avoiding
    14·1 answer
  • ) write a program that creates a vector of string called "vec". vector "vec" grows and shrinks as the user processes the transac
    6·1 answer
  • Which of the following is not a characteristic of a good value log entry
    15·1 answer
  • How can I watch you-tube on my school computer without it being blocked on the computer when it uses Lightspeed Systems Relay or
    7·1 answer
  • 3) Prompt the user for a 3-digit number, and the output should be the magical #, which is formed with each digit shifted to the
    13·1 answer
  • Which of the following is one of the tools in REPL.it that helps prevent syntax errors?
    10·1 answer
  • Choose the correct term to complete the sentence.
    12·1 answer
  • When is it appropriate to utilize the nat network connection type?
    8·1 answer
  • HELPPPPP Which tag used to add a new line:<br> A. ol<br> B. P<br> C. h1<br> D li
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!