MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / is_sq

Function is_sq

project_euler/problem_180/sol1.py:54–66  ·  view source on GitHub ↗

Check if number is a perfect square. >>> is_sq(1) True >>> is_sq(1000001) False >>> is_sq(1000000) True

(number: int)

Source from the content-addressed store, hash-verified

52
53
54def is_sq(number: int) -> bool:
55 """
56 Check if number is a perfect square.
57
58 >>> is_sq(1)
59 True
60 >>> is_sq(1000001)
61 False
62 >>> is_sq(1000000)
63 True
64 """
65 sq: int = int(number**0.5)
66 return number == sq * sq
67
68
69def add_three(

Callers 1

solutionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected