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. Hint: Define and use a loop variable.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 18PE
icon
Related questions
Question

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.

Hint: Define and use a loop variable.

 

< >
learn.zybooks.com
b Search results for 'Write a function sham...
ży Section 5.7 - IT 140: Introduction to Scri...
B 5-3 Project One Submission - IT-140-J6...
B Project One Guidelines and Rubric - IT-1...
My Courses
= zyBooks My library > IT 140: Introduction to Scripting v3 home > 5.7: Functions with branches/loops
E zyBooks catalog
? Help/FAQ
8 Victoria Thibodeaux
CHALLENGE
5.7.2: Function with loop: Shampoo.
АCTIVITY
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.
Hint: Define and use a loop variable.
247772.1992070.qx3zqy7
1 def print_popcorn_time(bag_ounces):
if bag_ounces < 3:
print("Too small")
if bag_ounces > 10:
print("Too large")
2
1 test
passed
3
4
5
All tests
6.
else:
passed
7
print(str(6 * bag_ounces)+
seconds")
8
9 user_cycles
10 shampoo_instructions(user_cycles)
int(input())
Run
X Test aborted
Transcribed Image Text:< > learn.zybooks.com b Search results for 'Write a function sham... ży Section 5.7 - IT 140: Introduction to Scri... B 5-3 Project One Submission - IT-140-J6... B Project One Guidelines and Rubric - IT-1... My Courses = zyBooks My library > IT 140: Introduction to Scripting v3 home > 5.7: Functions with branches/loops E zyBooks catalog ? Help/FAQ 8 Victoria Thibodeaux CHALLENGE 5.7.2: Function with loop: Shampoo. АCTIVITY 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. Hint: Define and use a loop variable. 247772.1992070.qx3zqy7 1 def print_popcorn_time(bag_ounces): if bag_ounces < 3: print("Too small") if bag_ounces > 10: print("Too large") 2 1 test passed 3 4 5 All tests 6. else: passed 7 print(str(6 * bag_ounces)+ seconds") 8 9 user_cycles 10 shampoo_instructions(user_cycles) int(input()) Run X Test aborted
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning