• Developers created classes to organize their code in a logical way.

    Imagine you store a switch in a dictionary, then you write functions to change it:

    switch = {
        "name": "SW1",
        "ip": "10.0.0.2",
        "vlans": [1, 10, 20]
    }
    
    def add_vlan(switch, vlan_id):
        switch["vlans"].append(vlan_id)
    
    def remove_vlan(switch, vlan_id):
        switch["vlans"].remove(vlan_id)

    A class puts the values and the functions of the switch in one place:

    The class Switch holds the values name, ip and vlans, what the switch has, and the functions add_vlan() and remove_vlan(), what you can do with it.

    Figure 1 - A Class Holds the Values and the Functions of a Switch

    A class is a new type that you create, like int for numbers or str for text.

    In the lab, the script prints the type of a number and the type of a text.
    Print the type of sw1 to get the flag.

    PS: look at the output of the script. The types int and str are classes too. In Python, every type is a class :)

    Answer the question below

    Enter the flag you obtained.