title: Class name is not defined
body: <pre><code>class MyClass:
      sample=0
      w=0
      b=0
      g=0
      o=0
      color_list=['black','white','gray']
  
      def __init__(self):
          print("Enter Your Name")
          MyClass.name=input()
          print("What's the color of ur car?")
          MyClass.color=input()
          MyClass.sample=MyClass.sample+1
  
      def check_color(self):
          if MyClass.color in MyClass.color_list:
  
              if MyClass.color==MyClass.color_list[0]:
                  MyClass.b=MyClass.b+1
              elif MyClass.color==MyClass.color_list[1]:
                  MyClass.w=MyClass.w+1
              else:
                  MyClass.g=MyClass.g+1
          else:
              MyClass.o=MyClass.o+1
  
      def display_result(self):
          print("Hello :",MyClass.name)
          print("Total number of black cars",MyClass.b)
          print("Total number of white cars",MyClass.w)
          print("Total number of gray cars",MyClass.g)
          print("Other cars",MyClass.o)
          print("Sample Size",MyClass.sample)
  
      var=0
      mylist=[]
      while var&lt;4:
          mylist.append(MyClass())
          mylist[var].check_color()
          mylist[var].display_result()
          var=var+1
  </code></pre>
  
  <p>Error at Python IDLE:</p>
  
  <pre class="lang-none prettyprint-override"><code>==== RESTART: C:/Python34/Practice Programs/TBT Tutorials/Day 4/class.py ====
  Traceback (most recent call last):
    File "C:/Python34/Practice Programs/TBT Tutorials/Day 4/class.py", line 1, in &lt;module&gt;
      class MyClass:
    File "C:/Python34/Practice Programs/TBT Tutorials/Day 4/class.py", line 41, in MyClass
      mylist.append(MyClass())
  NameError: name 'MyClass' is not defined
  </code></pre>