class - To define a class

This keyword defines a class which is a container for variables and functions.  As described elsewhere, a class can have an initializer as well.


class Acceleration:
    def __init__(self):
        # Initialize a couple class variables:
        self.G = 9.80665     # standard gravitational acceleration in m/s/s
        self.R = 6378000.1   # radius of earth

    # define a function that calculates acceleration at a given height:
    def atHeight(self, height):
        return self.G * (self.R / (self.R + height))**2

accel = Acceleration().atHeight(0)
print(f'{accel} m/s/s')


9.80665 m/s/s