About 106,000 results
Open links in new tab
  1. Is there a Python library to list primes? - Stack Overflow

    Nov 11, 2012 · Is there a library function that can enumerate the prime numbers (in sequence) in Python? I found this question Fastest way to list all primes below N but I'd rather use someone …

  2. math - How can I convert radians to degrees with Python ... - Stack ...

    Mar 26, 2012 · Python includes two functions in the math package; radians converts degrees to radians, and degrees converts radians to degrees. To match the output of your calculator you …

  3. Function for factorial in Python - Stack Overflow

    Feb 27, 2011 · 7 If you are using Python 2.5 or older, try from operator import mul def factorial(n): return reduce(mul, range(1, n+1)) For newer versions of Python, there is factorial in the math …

  4. python - Solving Quadratic Equation - Stack Overflow

    2 # syntaxis:2.7 # solution for quadratic equation # a*x**2 + b*x + c = 0 d = b**2-4*a*c # discriminant if d < 0: print 'No solutions' elif d == 0: x1 = -b / (2*a) print 'The sole solution is',x1 …

  5. python - What's the function like sum () but for multiplication ...

    Feb 28, 2009 · 165 Update: In Python 3.8, the prod function was added to the math module. See: math.prod (). Older info: Python 3.7 and prior The function you're looking for would be called …

  6. math - How do I calculate square root in Python? - Stack Overflow

    Jan 20, 2022 · Python's fractions module and its class, Fraction, implement arithmetic with rational numbers. The Fraction class doesn't implement a square root operation, because most square …

  7. How to perform square root without using math module?

    Jun 15, 2010 · I want to find the square root of a number without using the math module,as i need to call the function some 20k times and dont want to slow down the execution by linking to the …

  8. math - Inverse Cosine in Python - Stack Overflow

    Aug 4, 2020 · Apologies if this is straight forward, but I have not found any help in the python manual or google. I am trying to find the inverse cosine for a value using python. i.e. cos⁻¹(x) …

  9. Python : name 'math' is not defined Error? - Stack Overflow

    Feb 1, 2015 · You did a mistake.. When you wrote : from math import * # This imports all the functions and the classes from math # log method is also imported. # But there is nothing …

  10. python - How do you round UP a number? - Stack Overflow

    May 5, 2017 · The math module and math.ceil() is in the standard library, so available everywhere for all practical purposes without installing extra stuff. And regarding your mention of when it …