Question: Documentation: Use the following template for EVERY function that you write. The docstring below should be placed inside of the function, just after the function

 Documentation: Use the following template for EVERY function that you write.
The docstring below should be placed inside of the function, just after
the function signature. Purpose: Parameter(s): Return Value: Problem A. (10 points) Greater

Documentation: Use the following template for EVERY function that you write. The docstring below should be placed inside of the function, just after the function signature. Purpose: Parameter(s): Return Value: Problem A. (10 points) Greater By One This problem will exercise your ability with looping constructs over a string. Write two functions called greater_by_one_for_a_string) and greater_by_one_while(a_string) Both functions will take in one parameter a_string, which represents a string object which contains only digits. Both functions will also build and return a string in which all of the digits between 0 and 8 have been replaced with the digit with a value one greater than the original value. All 9s should be replaced with the digit 0. Constraints: - In function greater_by_one_for_a_string): You must use a for loop and may not use a while loop - In function greater_by_one_while(a_string): You must use a while loop and may not use a for loop Hints: - If we divide an integer n which is less than 10 by 10 , we will get a remainder of n. Hints: - If we divide an integer n which is less than 10 by 10 , we will get a remainder of n. - If a string is an empty string, then an empty string should be returned. You are welcome to add an if ___ name =_ '_ main _ block and test cases for this and all functions in this assignment but this is not required. Examples (text in bold is returned): greater_by_one_for (") greater_by_one_for ("123) 234 ' greater_by_one_while("234") ' 345 greater_by_one_for ("93023) ' 04134 greater_by_one_while("93023") '04134' Problem B. (10 points) Count of Sums This problem will exercise your ability with looping constructs over integers. Write a function called count_of_sums(lower, upper,_sum_val). This function will take in three parameters: Lower, which is an integer that represents the bottom of the searchable range(inclusive), upper which is an integer which represents the upper end of the searchable range (inclusive), and sum_val which represents the integer sum you are checking against. This function will return an int, representing all of the possible ways to sum two integers This problem will exercise your ability with looping constructs over integers. Write a function called count_of_sums(lower, upper, sum_val). This function will take in three parameters: lower, which is an integer that represents the bottom of the searchable range(inclusive), upper which is an integer which represents the upper end of the searchable . range (inclusive), and sum_val which represents the integer sum you are checking against. This function will return an int, representing all of the possible ways to sum two integers between lower and upper and get sum_val. A+B= sum__al and B+A= sum_val count as two different possible ways to sum two integers between lower and upper. For example, count_of_sums (2,10,8) would return 5 , because there are 5 pairs of integers in the range [2,10] that sum to 8 : 2+63+54+45+36+2 Constraints: - You must use a looping construct of some kind to solve this problem. You are welcome to add an if name _ == ' main _ block and test cases for this and all functions in this assignment but this is not required. Examples (text in bold is returned): count_of_sums (2,10,8)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!