ptython math methods

Solutions on MaxInterview for ptython math methods by the best coders in the world

showing results for - "ptython math methods"
Aiden
12 May 2016
1math.acos()	Returns the arc cosine of a number
2math.acosh()	Returns the inverse hyperbolic cosine of a number
3math.asin()	Returns the arc sine of a number
4math.asinh()	Returns the inverse hyperbolic sine of a number
5math.atan()	Returns the arc tangent of a number in radians
6math.atan2()	Returns the arc tangent of y/x in radians
7math.atanh()	Returns the inverse hyperbolic tangent of a number
8math.ceil()	Rounds a number up to the nearest integer
9math.comb()	Returns the number of ways to choose k items from n items without repetition and order
10math.copysign()	Returns a float consisting of the value of the first parameter and the sign of the second parameter
11math.cos()	Returns the cosine of a number
12math.cosh()	Returns the hyperbolic cosine of a number
13math.degrees()	Converts an angle from radians to degrees
14math.dist()	Returns the Euclidean distance between two points (p and q), where p and q are the coordinates of that point
15math.erf()	Returns the error function of a number
16math.erfc()	Returns the complementary error function of a number
17math.exp()	Returns E raised to the power of x
18math.expm1()	Returns Ex - 1
19math.fabs()	Returns the absolute value of a number
20math.factorial()	Returns the factorial of a number
21math.floor()	Rounds a number down to the nearest integer
22math.fmod()	Returns the remainder of x/y
23math.frexp()	Returns the mantissa and the exponent, of a specified number
24math.fsum()	Returns the sum of all items in any iterable (tuples, arrays, lists, etc.)
25math.gamma()	Returns the gamma function at x
26math.gcd()	Returns the greatest common divisor of two integers
27math.hypot()	Returns the Euclidean norm
28math.isclose()	Checks whether two values are close to each other, or not
29math.isfinite()	Checks whether a number is finite or not
30math.isinf()	Checks whether a number is infinite or not
31math.isnan()	Checks whether a value is NaN (not a number) or not
32math.isqrt()	Rounds a square root number downwards to the nearest integer
33math.ldexp()	Returns the inverse of math.frexp() which is x * (2**i) of the given numbers x and i
34math.lgamma()	Returns the log gamma value of x
35math.log()	Returns the natural logarithm of a number, or the logarithm of number to base
36math.log10()	Returns the base-10 logarithm of x
37math.log1p()	Returns the natural logarithm of 1+x
38math.log2()	Returns the base-2 logarithm of x
39math.perm()	Returns the number of ways to choose k items from n items with order and without repetition
40math.pow()	Returns the value of x to the power of y
41math.prod()	Returns the product of all the elements in an iterable
42math.radians()	Converts a degree value into radians
43math.remainder()	Returns the closest value that can make numerator completely divisible by the denominator
44math.sin()	Returns the sine of a number
45math.sinh()	Returns the hyperbolic sine of a number
46math.sqrt()	Returns the square root of a number
47math.tan()	Returns the tangent of a number
48math.tanh()	Returns the hyperbolic tangent of a number
49math.trunc()	Returns the truncated integer parts of a number
Lou
11 Aug 2019
1import math
Sara
17 Jan 2021
1Arithmetic:
2operator   |  name                    | example |
3+			Addition	    			x + y	
4-			Subtraction	    			x - y	
5*			Multiplication				x * y	
6/			Division	    			x / y	
7%			Modulus     				x % y	
8**			Exponentiation				x ** y	
9//			Floor division				x // y
10
11Comparison:
12Operator |           Name                  | Example |
13==				Equal	       				x == y	
14!=				Not equal					x != y	
15>				Greater than				x > y	
16<				Less than					x < y	
17>=				Greater than or equal to	x >= y	
18<=				Less than or equal to	    x <= y
19
20Assignment:
21Operator  |	Example	|
22=	     	x = 5	
23+=			x += 3	
24-=			x -= 3	
25*=			x *= 3		
26/=			x /= 3	
27%=			x %= 3		
28//=			x //= 3	
29**=			x **= 3	
30&=			x &= 3	
31|=			x |= 3			
32^=			x ^= 3			
33>>=			x >>= 3				
34<<=			x <<= 3			
35
36
37
Agustín
11 Mar 2018
1// Python mathematical functions include but are not limited to:
2print(10+10) // Returns 20 (Addition)
3print(10*10) // Returns 100 (Multiplication)
4print(10/10) // Returns 1 (Division)
5print(10**10) // Returns 10000000000 (10 to the power of 10, 10^10)
6print(10-10) // Returns 0 (Subtraction)
7print(10>100) // Returns False (If A is greater than B)
8print(10<100) // Returns True (If A is less than B)
9print(10==10) // Returns True (If A is equal to B)
10
11import math // Required for the function below
12print(math.pi) // Returns the first 15 decimal places of Pi
Maya
25 Jun 2019
1math.e	Returns Euler's number (2.7182...)
2math.inf	Returns a floating-point positive infinity
3math.nan	Returns a floating-point NaN (Not a Number) value
4math.pi	Returns PI (3.1415...)
5math.tau	Returns tau (6.2831...)
similar questions
queries leading to this page
ptython math methods