TypeError: YN_prompt() missing 1 required positional argument: 'self'
<p>I'm new to python and I'm kind of stuck. When I run my program, I get this </p>

<pre><code>"Traceback (most recent call last):
  File "C:/Users/Dell/Documents/Code/junk.py", line 1, in &lt;module&gt;
    class E:
  File "C:/Users/Dell/Documents/Code/junk.py", line 27, in E
    YN_prompt()
TypeError: YN_prompt() missing 1 required positional argument: 'self'
</code></pre>

<p>I don't understand what I am doing wrong, can someone please explain to me what that error message means? Thanks.</p>

<pre><code>class E:
    import random
    import time
    thing = 1
    cookie = random.randrange(4)

    def YN_prompt(self):
        ugly = 1
        while ugly == 1:
            yn = input("\n Go again? y/n \n")
            if yn == ("y"):
                continue
            elif yn == ("n"):
                quit()
            else:
                print("ILLEGAL VALUE, CHOOSING ANOTER")
                time.sleep(0.2)
                continue


    while thing == 1:
        if cookie == 0:
            print("hi")
            YN_prompt()
        elif cookie == 1:
            print("no")
            YN_prompt()
        elif cookie == 2:
            print("why")
            YN_prompt()
        elif cookie == 3:
            print("when")
            YN_prompt()
        elif cookie == 4:
            print("who")
            YN_prompt()
</code></pre>

<p>You need to instantiate a class instance first. For example: </p>

<pre><code>Example_class = E()
</code></pre>

<p>and then you can call your function like this</p>

<pre><code> Example_class.YN_prompt()
</code></pre>

<p>Check this older post for more infos <a href="http://stackoverflow.com/questions/17534345/typeerror-missing-1-required-positional-argument-self">link</a></p>

python