Question: the program is pycharm Part IV: Count Perfect Squares (20 points) Write a function count.perfect.squares () that counts how many integers in a range are

 the program is pycharm Part IV: Count Perfect Squares (20 points) the program is pycharm

Part IV: Count Perfect Squares (20 points) Write a function count.perfect.squares () that counts how many integers in a range are perfect squares. The function takes the following arguments, in this order. min.num: an integer that provides the lower bound of the range to check max.num: an integer that provides the upper bound of she range to check You might find the function math.sart useful in solving this problem. As its name suggests, this function computes the square root of a value. For example math.sqrt (30) returns the value 5.477225575051661. math.sqrt (25) returns 5.0. Note that the function returns a real number, but for this problem we want to count the number of integers that are perfect squares. Luckily, there is a simple solution. If we want to compute the integer square root of a value n, we can simply write int (math.sqrt (n)). As an example, for the arguments 44, 67, there are 2 perfect squares in the range 44,67, and so the function CSE 101 - Spring 2020 Homework #2 will return 2 for this input. In the case that the lower bound is higher than the upper bound, the function returns -1 to indicate an error Examples: Function Argument Return Value 1, 25 25, 100 48, 49 44, 2 1, 100 101, 10000

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!