About 13,800,000 results
Open links in new tab
  1. How can I test if a number is a square number in Python?

    Using pure maths (no libraries) a square number can be determined in Python as follows: not n**0.5 % 1 As the square root of a square integer is an integer, this test uses modulo 1 equal …

  2. input - Python - Check if a number is a square - Stack Overflow

    To check if a number is a square, you could use code like this: import math number = 16 if math.sqrt(number).is_interger: print "Square" else: print "Not square" import math import s the …

  3. python - Check if a number is a perfect square - Stack Overflow

    Mar 22, 2010 · Use Newton's method to quickly zero in on the nearest integer square root, then square it and see if it's your number. See isqrt. Python ≥ 3.8 has math.isqrt. If using an older …

  4. python - Check if number is square? - Stack Overflow

    Apr 18, 2019 · How to find out if a number is a perfect square without using sqrt function or ** in Python?

  5. What is the fastest way to decide whether a number is a square number ...

    Write a function to compute integer square roots. Newton's method can be used (with care). A simple binary search is even easier to implement and gives decent performance, even for …

  6. How to Check if a Number is a Perfect Square in Python

    Take input from a user (num). Create one variable called flag and initially set it to zero (flag = 0). iterate through the loop from 1 to num (for i in range(1, num+1)). Outside the loop check if flag …

  7. Python | Check if the given Number is a Perfect Square or not

    Sep 6, 2021 · In Python, if you have to check whether a given number is a perfect square or not, then you are at the right place. In this article we will cover two different approach for doing this.

  8. 5 Best Ways to Check if a Given Number is a Perfect Square in Python

    Mar 8, 2024 · Calculating the square root and checking if it’s an integer is a straightforward way to verify if a number is a perfect square. Python’s math.sqrt() function is used, and then we verify …

  9. Check if a Number is a Square Number in Python - CodingFleet

    Check if a Number is a Square Number in Python Created at using the Python Code Generator tool.

  10. How to check for a perfect square in python - Tpoint Tech - Java

    Aug 29, 2024 · To check whether a given number is a perfect square or not there are several methods using various inbuilt functions and various operators in python. Some of the main …

  11. Some results have been removed
Refresh