About 33,000 results
Open links in new tab
  1. How to find length of digits in an integer? - Stack Overflow

    Worth noting for all the answers saying to use len(str(n)), in newer versions of Python this will break for integers with over 4300 digits because converting the full binary into base 10 is very …

  2. python - Count the digits in a number - Stack Overflow

    Dec 7, 2021 · I have written a function called count_digit: # Write a function which takes a number as an input # It should count the number of digits in the number # And check if the number is a …

  3. How to count digits, letters, spaces for a string in Python?

    As far as the actual question "How to count digits, letters, spaces for a string in Python", at a glance the rest of the "revised code" looks OK except that the return line is not returning the …

  4. Counting number of digits of input using python - Stack Overflow

    May 22, 2018 · I am trying to count the number of digits of an input. However, whenever I input 10 or 11 or any two digit number, the output is 325. Why doesn't it work? inputnumber = int (input …

  5. Count number of digits using for loop in Python - Stack Overflow

    Sep 16, 2022 · I want to count number of digits of any digits number without converting the number to string and also using for loop. Can someone suggest how to do this. num = int …

  6. python - Easy way of finding decimal places - Stack Overflow

    Apr 5, 2022 · Is there an easy way or integrated function to find out the decimal places of a floating point number? The number is parsed from a string, so one way is to count the digits …

  7. python - Count decimal places in a float - Stack Overflow

    Oct 7, 2014 · In python, I import a file that has different length decimal places in the numbers, such as 7.2 or 7.2332 Is it possible to find out the number of decimal places in the number, if …

  8. python - How can I make this function count the number of digits …

    Feb 14, 2022 · Strictly speaking, floats don't have digits, they have significant figures. For example, 1e+30 is represented with three numbers (one sig fig plus a two-digit mantissa), but …

  9. python - Recursion function for counting the number of digits in a ...

    Dec 2, 2014 · Recursion function for counting the number of digits in a number? Asked 10 years, 11 months ago Modified 1 year ago Viewed 17k times

  10. math - Counting significant figures in Python? - Stack Overflow

    Nov 12, 2011 · Python counting significant digits The idea here is that you pass the float as a String to the methods, and then the method uses regular expressions to count the number of …