python3 math code example

Example 1: math pyhon ?

Arithmetic:
operator   |  name                    | example |
+			Addition	    			x + y	
-			Subtraction	    			x - y	
*			Multiplication				x * y	
/			Division	    			x / y	
%			Modulus     				x % y	
**			Exponentiation				x ** y	
//			Floor division				x // y

Comparison:
Operator |           Name                  | Example |
==				Equal	       				x == y	
!=				Not equal					x != y	
>				Greater than				x > y	
<				Less than					x < y	
>=				Greater than or equal to	x >= y	
<=				Less than or equal to	    x <= y

Assignment:
Operator  |	Example	|
=	     	x = 5	
+=			x += 3	
-=			x -= 3	
*=			x *= 3		
/=			x /= 3	
%=			x %= 3		
//=			x //= 3	
**=			x **= 3	
&=			x &= 3	
|=			x |= 3			
^=			x ^= 3			
>>=			x >>= 3				
<<=			x <<= 3

Example 2: tangent python 3

import math
import random

#the tangent can be anything
variable = random.randint(6, 9)

#here we print the tangent with atan (tangent)
print(atan(variable))

Example 3: pi python

# import built in math module
import math

# Showing usage of pi function
print(math.pi)