Q:

How do methods within a class access class constant variables?

I'm confused how to access class variables while in methods. For example, what are the ways that the compare method below can use the class variable COURSES? I got it to work by adding self before calling COURSES (self.COURSES.items()), but is that correct? I feel like it is bad practice and I'm missing something, but I can't seem to find the answer. Thanks, everyone. 
class Example:
    COURSES = {
    "Python Basics": {"Python", "functions", "variables",
                      "booleans", "integers", "floats",
                      "arrays", "strings", "exceptions",
                      "conditions", "input", "loops"},
    "Java Basics": {"Java", "strings", "variables",
                    "input", "exceptions", "integers",
        }

    def compare(self, arg):
        intersection_list = []
        for key, value in COURSES.items():
        if value & arg:
            intersection_list.append(key)
        return intersection_list

A:

Yes, using self. COURSES is ok. Python has so called "data inheritance". When you write self. COURSES it looks for COURSES in self.__dict__. If the attribute is not found there, self.__class__.__dict__ is searched -- and your class attribute is found. If the attribute is not found is class's __dict__ parent classes are searched.
See also: https://www.python-course.eu/python3_class_and_instance_attributes.php

