Welcome

To my totally awesome 90s Python corner!

IE Logo Netscape Logo

*** New content added! Check out the Math Module section! ***

Visitor Counter Visitor Count!

Cool Counter

1000000


Navigation Navigation

Go to Main Page

Sign My Guestbook!

Cool Links

Email Me!

Email Me

Computer Math Operations

Divider

Let's do some radical math!

Operation Description Result
a = 3
b = 4
a + b Sum of a and b (7)
a - b Subtract b from a (-1)
a * b a times b (12)
a / b a divided by b (0.75)
a // b Integer part of a divided by b (0)
a % b Rest of a divided by b (3)
a ** b a to the power of b (81)
Divider

Hacker Logic Tests

Divider

Testing out some logic!

Test Description Result
5 > 3 Tests if 5 is greater than 3 True
5 >= 3 Tests if 5 is greater than or equal to 3 True
5 == 3 Tests if 5 is equal to 3 False
5 != 3 Tests if 5 is different than 3 True
5 <= 3 Tests if 5 is lower than or equal to 3 False
5 < 3 Tests if 5 is lower than 3 False
not True Opposite of True False
Divider

Computer Math Module

Divider

Exploring the groovy math module!

Function Description
import math Imports the math module
math.ceil(x) Rounds x up
math.floor(x) Rounds x down
round(x) 1 Rounds x with 0 decimal places
round(x, 2) 1 Rounds x with 2 decimal places
math.sqrt(x) Square root of x
math.sin(angle) Sine of angle
math.cos(angle) Cosine of angle
math.tan(angle) Tangent of angle
math.sinh(x) Hyperbolic sine of x
math.cosh(x) Hyperbolic cosine of x
math.tanh(x) Hyperbolic tangent of x
math.asin(angle) Arc sine of angle
math.acos(angle) Arc cosine of angle
math.atan(angle) Arc tangent of angle
math.asinh(x) Inverse hyperbolic sine of x
math.acosh(x) Inverse hyperbolic cosine of x
math.atanh(x) Inverse hyperbolic tangent of x
math.degrees(angle) 2 Convert angle from radians to degrees
math.radians(angle) 2 Convert angle from degrees to radians
math.factorial(x) Factorial of x
math.gamma(x) Gamma function of x
math.exp(x) e to the power of x
math.log(x) Natural logarithm of x
math.log(x, 2) Base 2 logarithm of x
math.e Constant e
math.pi Constant pi

1 round is not part of the math module.

2 The Python standard is to work with angles in radians.

Divider

7up Spot Second Degree Equation Roots

Divider

Solving quadratic equations is a breeze!

# This script solves ax^2 + bx + c = 0

import math

a = 1

b = -1

c = -6

delta = b**2 - 4*a*c

r1 = (-b + math.sqrt(delta))/(2*a)

r2 = (-b - math.sqrt(delta))/(2*a)

print(f"r1 = {r1}")

print(f"r2 = {r2}")

Results:

r1 = 3.0

r2 = -2.0

Under Construction More Cool Stuff Coming Soon!

Construction

This section is still under construction, but I'm working hard to bring you more awesome Python content! Check back soon!

Stay Tuned!
Under Construction New! Generate your own 90s page here! Under Construction