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
Nesterboy [21]
3 years ago
7

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.". Sample output with input: 2 1 : Lather and rinse. 2 : Lather and rinse. Done.

Computers and Technology
1 answer:
Rashid [163]3 years ago
3 0

Answer:

The code written in python and fully commented for this question is given below:

# Create the function shampoo_instructions with the num_cycles parameter input

def shampoo_instructions(num_cycles):

   # Condition if is less than 1, print too few

   if num_cycles < 1:

       print("Too few.")

   # Condition if is greater than 4, print too many

   elif num_cycles > 4:

       print("Too many.")

   # If is in inclusive range [1,4], print the Lather and rinse cycle

   else:

       # Create a for loop to print rinse cycle

       for i in range(num_cycles):

           print("{}: Lather and rinse.".format(i+1))

   # Print an end string for each execution

   print("End-------------------------------------")

# Call the function with all the conditions tested

shampoo_instructions(3)

shampoo_instructions(0)

shampoo_instructions(4)

shampoo_instructions(5)

Explanation:

I attach an image that contains the output of the execution and the source code.

You might be interested in
Gps receivers are commonly used by individuals to determine their geographic location while hiking and to obtain driving directi
soldier1979 [14.2K]
I think it is true also.
7 0
3 years ago
The force that pulls away from a curve is known as
77julia77 [94]

The correct answer is centrifugal force.

The force that pulls out from the center on a body that is in a circular motion is called centrifugal force. This force increases as the speed of motion increases. It is centrifugal force that results in a strong outward pull on your vehicle traveling around a corner.

7 0
3 years ago
The divBySum method is intended to return the sum of all the elements in the int array parameter arr that are divisible by the i
iragen [17]

Answer:

The complete method is as follows:

public static int divBySum(int[] arr, int num){        

     int sum = 0;

     for(int i:arr){

         if(i%num == 0)

         sum+=i;

     }

     return sum;

   }

Explanation:

As instructed, the program assumes that arr has been declared and initialized. So, this solution only completes the divBySum method (the main method is not included)

This line defines the method

public static int divBySum(int[] arr, int num){        

This line declares and initializes sum to 0

     int sum = 0;

This uses for each to iterate through the array elements

     for(int i:arr){

This checks if an array element is divisible by num (the second parameter)

         if(i%num == 0)

If yes, sum is updated

         sum+=i;

     }

This returns the calculated sum

     return sum;

   }

8 0
3 years ago
Mary needs to choose the menu in order to place the text in a desired fashion around the image.
mixas84 [53]
Full features



Option C


hope this one help
6 0
3 years ago
Determining which computer platform (operating system) would be best for a particular student often depends on what the student
leva [86]

Answer: Window OS

Explanation:

Based on the information given, it should be noted that the students who plan to study graphic design should consider the Window OS platform since it is considered to be the industry standard in those fields.

Microsoft Windows, also refered to as the Windows OS, is a computer operating system that's developed by Microsoft to run personal computers. It has the first graphical user interface and also, the Windows OS dominates the personal computer market.

4 0
2 years ago
Other questions:
  • A digital footprint is all of the information on-line about a person posted by that person or others, ____________. intentionall
    14·1 answer
  • Consider a single CPU system with an active process A. Explain what happens in the following circumstances including any interru
    13·1 answer
  • The "instance" relationship shows that something is an object of a ____.
    5·1 answer
  • darren wants to substitute every occurence of the word bulky in his spreadsheet with the word strong. which of these options sho
    9·2 answers
  • Instead of sending an entire file in one big chunk across the​ Internet, __________ is used which dices the file up into little
    12·1 answer
  • Find the number of times a value appears in a list, and create a new list that contains the index positions where the value occu
    6·1 answer
  • Good keyboarding technique includes ________
    7·2 answers
  • A corporate or government network that uses Internet tools, such as Web browsers, and
    13·1 answer
  • Computer programming
    5·1 answer
  • There are ______ type of accounts
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!