Instructions

Run the following program, using the Stop button if needed.

Fix any errors and run the program again.

Here is the while loop recipe for your reference.

  • Express the task as iteration.
  • Write a condition.
  • Ensure initial values of variables checked in the condition.
  • Ensure the condition can change in the body of the loop.

Note:

Hints:

  • Make sure that count has an initial value.

Run the following program, using the Stop button if needed.

Fix any errors and run the program again.

Here is the while loop recipe for your reference.

  • Express the task as iteration.
  • Write a condition.
  • Ensure initial values of variables checked in the condition.
  • Ensure the condition can change in the body of the loop.

Note:

Hints:

  • You can review the syntax for a while loop by rewatching Step 4.

Write a function my_power that consumes two inputs base and exponent, where base is a positive integer or floating point number and exponent is a positive integer. Your function should produce base to the exponent power. The computation should be made using repeated multiplication.

For example, to compute my_power(4, 3) you will determine the cube of 4 by computing 4 times 4 times 4.

Note:

Hints:

  • You should execute the body of the loop exponent times.

Write a function add_up that adds integers provided by the user, stopping when the user writes "Stop".

Note:

Hints:

  • If you need to review how to obtain input from a user, you can rewatch Module 2, Step 4.

Write a function no_nums that consumes a string and produces a string which has the same characters as the input but with any digit removed.

Note:

Hints:

  • To review how to process each character in the string in turn, you might wish to rewatch Step 5.

Write a function swap_case that consumes a string and produces a string which has the same characters as the input but with any lower-case letter replaced by the corresponding upper-case letter and any upper-case letter replaced by the corresponding lower-case letter.

Note:

Hint:

  • To choose among the options, you might wish to review how to branch when you have more than two cases by rewatching Module 6, Step 7.

Write a function multisplit that consumes two positive integers total and split and produces the number of times total is repeatedly divided into split even pieces before each piece is of size at most 1.

For example, the value returned by multisplit(8, 2) will be 3, since 8 can be split into 2 pieces of size 4, which are then each split into 2 pieces of size 2, which are then each split into 2 pieces of size 1 (at which point no further splitting takes place since the pieces are of size at most 1). The value returned by multisplit(8, 3) will be 2, since 8 can be split into 3 pieces of size 8/3, which are then each split into 3 pieces of size 8/9 (at which point no further splitting takes place since the pieces are of size at most 1).

Note:

Hints:

  • Use a variable to keep track of how many times splits have taken place.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX