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
A(n) ____ is a collection of one or more program statements combined to perform some action
finlep [7]

The answer is Method

A method is a code block of statements that perform a task. By calling a method, a program causes statements to be executed. In C# programming, every instruction that is executed is performed in the context of a method. Technically, it is how behaviors are implemented in C# and are enclosed in parentheses separated by commas






3 0
3 years ago
Create a Python program that asks the user in which direction to go? north, South East, or West?
QveST [7]

Answer:

huh

Explanation:

adsfghjkhgfdghjfghjkl

7 0
3 years ago
While you are working on your computer, it shuts down unexpectedly, and you detect a burning smell. When you remove the case cov
Virty [35]

Answer:

Replace the power supply

Explanation:

Usually, Capacitors burn up because of different factors.

- Exceeding operation voltage

- High Inverse voltage if is an electrolytic capacitor.

A tentative answer could be the battery, but usually the batteries damages are because wear out of them, that is, cycles of charging and discharging, a problem that could arise in the battery is related with the charge protection, this circuit cares that the battery only get the charge that it needs, in Li-po batteries is 3.7V, in some laptops is 24 V, if so the battery could explode or leaking acid.  

The mother-board is the "brain" and the Random Access Memory (RAM), they consume a lot of energy and usually heat up, but doesn’t produce increasing of voltage and its feed it by voltage regulators.

The only valid option is the power supply because the energy comes from a rectifier (made with diodes) and a voltage regulator that step-down the DC voltage output if by any chance the voltage increase or a diode burns up in the power supply the coupling capacitors or input capacitors in the computer will fail.

5 0
3 years ago
The interprets the data while it is in RAM​
Katena32 [7]

Answer:

The input interprets the data while it is in RAM.

Explanation:

5 0
3 years ago
C2.5 - A group of four pirates has a treasure chest and one unique lock and key for each pirate. Using hardware that is probably
slavikrds [6]

Answer:

Explanation:

All the pirates uses their individual key and lock for the locking down of each the four sides of the lid of to the chest. Among the pirates, if three of them decides to open their latches, they can be able to lift the top by essentially using the fourth (locked) latch as a hinge to open the top. (We have several solutions or ways to do this.)

3 0
3 years ago
Other questions:
  • Which option should you select to ignore all tracked changes in a document
    6·1 answer
  • Which topology enables only one person, at one time, to send data to others on the network?
    6·1 answer
  • A newspaper wants to estimate the proportion of Americans who will vote for Candidate A. A random sample of 1000 voters is selec
    14·1 answer
  • / Looks up author of selected books
    15·1 answer
  • Python 3 (not java)1.Assume that word is a variable of type String that has been assigned a value. Write an expression whose val
    14·1 answer
  • Complete the sentence.
    5·1 answer
  • How do you loop a makebeat in earsketch
    11·1 answer
  • Think about the five steps to writing an algorithm. Why is each step necessary?
    6·2 answers
  • Which device allows you to convert sounds into digital format to be used on the computer​
    8·1 answer
  • . When you ____________________ a word, you can use a single line, a double lines, a dotted line, or even a wavy line!
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!