This is a draft cheat sheet. It is a work in progress and is not finished yet.
Math Operations
|
|
|
Sum a and b (7) |
|
Subtract b from a (-1) |
|
a times b (12) |
|
a divided by b (0.75) |
|
Integer part of a divided by b (0) |
|
Rest of a divided by b (3) |
|
a to the power of b (81) |
Logic Tests
|
Tests if 5 is greater than 3 (True) |
|
Tests if 5 is greater than or equal to 3 (True) |
|
Tests if 5 is equal to 3 (False) |
|
Tests if 5 is different than 3 (True) |
|
Tests if 5 is lower than or equal to 3 (False) |
|
Tests if 5 is lower than 3 (False) |
|
Opposite of True (False) |
Math Module
|
Imports module math |
|
Rounds x up |
|
Rounds x down |
|
Rounds x with 0 decimal places |
|
Rounds x with 2 decimal places |
|
Square root of x |
|
Sine of angle |
|
Cosine of angle |
|
Tangent of angle |
|
Hiperbolic sine of x |
|
Hiperbolic cosine of x |
|
Hiperbolic tangent of x |
|
Arc sine of angle |
|
Arc cosine of angle |
|
Arc tangent of angle |
|
Inverse hiperbolic sine of x |
|
Inverse hiperbolic cosine of x |
|
Inverse hiperbolic tangent of x |
|
Covert rad_angle from radians to degrees |
|
Covert rad_angle from degrees to radians |
|
Factorial of x |
|
Gamma function of x |
|
e to the power of x |
|
Natural logarithm of x |
|
Base 2 logarithm of x |
|
Constant e |
|
Constant pi |
1 round is not part of the math module
2 the python standard is to work with angles in radians
Second Degree Equation Roots
# This script solves ax^2 + bx + c = 0
import math
a = 1
b = -1
c = -6
delta = b*2 - 4a*c
r1 = (-b + math.sqrt(delta))/(2*a)
r2 = (-b - math.sqrt(delta))/(2*a)
print(f"r1 = {r1}")
print(f"r2 = {r2}")
|
|
|
|