Check if a number is perfect square number or not :param num: the number to be checked :return: True if number is square number, otherwise False >>> perfect_square(9) True >>> perfect_square(16) True >>> perfect_square(1) True >>> perfect_square(0) True
(num: int)
| 2 | |
| 3 | |
| 4 | def perfect_square(num: int) -> bool: |
| 5 | """ |
| 6 | Check if a number is perfect square number or not |
| 7 | :param num: the number to be checked |
| 8 | :return: True if number is square number, otherwise False |
| 9 | |
| 10 | >>> perfect_square(9) |
| 11 | True |
| 12 | >>> perfect_square(16) |
| 13 | True |
| 14 | >>> perfect_square(1) |
| 15 | True |
| 16 | >>> perfect_square(0) |
| 17 | True |
| 18 | >>> perfect_square(10) |
| 19 | False |
| 20 | """ |
| 21 | return math.sqrt(num) * math.sqrt(num) == num |
| 22 | |
| 23 | |
| 24 | def perfect_square_binary_search(n: int) -> bool: |
nothing calls this directly
no outgoing calls
no test coverage detected