1class Shark:
2 animal_type = "fish"
3 location = "ocean"
4 followers = 5
5
6new_shark = Shark()
7print(new_shark.animal_type)
8print(new_shark.location)
9print(new_shark.followers)
1# Class variables refer to variables that are made within a class.
2# It is generated when you define the class.
3# It's shared with all the instance of that class.
4# Example:
5
6class some_variable_holder(object):
7
8 var = "This variable is created inside the class some_variable_holder()."
9
10 def somefunc(self):
11 print("Random function ran.")
12
13thing = some_variable_holder()
14another_thing = some_variable_holder()
15
16# Both does the same thing because the same variable has been passed on from the class.
17thing.var
18another_thing.var