4 examples of 'perfect square in python' in Python

Every line of 'perfect square in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
10def square(numbers, queue):
11 for i in numbers:
12 queue.put(i*i)
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

4def checkIfSquare(n):
5 start = 0
6 end = int(n)
7 while start <= end:
8
9 mid = (start + end) // 2
10 val = mid * mid
11
12 if val == int(n):
13 return True
14 elif val < int(n):
15 start = mid + 1
16 else:
17 end = mid - 1
18
19 return False
4def square(numbers):
5 print("Print squares")
6 for n in numbers:
7 time.sleep(0.2)
8 print("Square", n*n)
20def is_square( num ):
21 return math.pow( int(math.sqrt(num)), 2 ) == num

Related snippets