Skip to content

Instantly share code, notes, and snippets.

@morisasy
Created December 30, 2017 12:38
Show Gist options
  • Save morisasy/68deaf6ac7fa42a8045dab3c3fd17e81 to your computer and use it in GitHub Desktop.
Save morisasy/68deaf6ac7fa42a8045dab3c3fd17e81 to your computer and use it in GitHub Desktop.
def nearest_square(limit):
""" Find the largest square number smaller than limit. """
answer = 0
while (answer+1)**2 < limit:
answer += 1
return answer**2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment