Question: Complete the isPerfectSquare and listOfPerfectSquares functions. The isPerfectSquare function accepts a positive integer and returns a boolean indicating whether the integer is a perfect
Complete the isPerfectSquare and listOfPerfectSquares functions. The isPerfectSquare function accepts a positive integer and returns a boolean indicating whether the integer is a perfect square. Recall that a perfect square is an integer whose square root is also an integer. The listOfPerfectSquares function accepts a list of positive integers and returns a list of booleans of the same length. The value at each position in the returned list should denote whether the corresponding integer in the original list is a perfect square. Sample Case 1 Sample Call isPerfectSquare (16) -> True Sample Case 2 Sample Call isPerfectSquare (29) -> False Sample Case 3 Sample Call listOfPerfectSquares ([8, 55, 49, 1, 121, 77, 14, 65, 64, 21, 25, 49])-> [False, False, True, True, True, False, False, False, True, False, True, True]
Step by Step Solution
3.39 Rating (152 Votes )
There are 3 Steps involved in it
Solution To check whether the number is a perfect square or not we will first find the square root o... View full answer
Get step-by-step solutions from verified subject matter experts
