Python Write Better Python Cleaner Code Function and Class Whitespace

Nigel Chia
Nigel Chia
909 Points

whitespaces

Add the correct amount of whitespace between the functions, between the functions and the class, and before the class method.

all is says is Bummer! try again

starter.py
def first_function(arg1):
    return 'arg1 is {}'.format(arg1)


def second_function(arg1):
    return 'arg1 is {}'.format(arg1)


def class_func(self):
    return self.args


class MyClass:
    args = [1, 2, 3]

1 Answer

Mind the number of lines left vacant between the entities. And class_func is the method of the MyClass.

def first_function(arg1):
    return 'arg1 is {}'.format(arg1)


def second_function(arg1):
    return 'arg1 is {}'.format(arg1)


class MyClass:
    args = [1, 2, 3]

    def class_func(self):
        return self.args