Python, 'return' outside function error
<p>I was writing this code in C++ and it kept giving me an answer that I didn't want so I thought I should write it in python, so when I did it gave me the error "<em>*</em> 'return' outside function ([Place on hard drive], line 7)". I searched it and found that it was to do with indentions, so I re-wrote that line of code but I still get this error. Also the program it's self is most likely wrong and I’m not asking for you to fix that but in theory it should work, also it is to convert decimal to binary as a number. Thanks in advance :).</p>

<p>Here’s the code:</p>

<pre><code>class gimmeANumber():
    while True:
        Number = raw_input("Please can you input a number from 0 to 255\n")
        if Number &lt; 0 or 255 &lt; number:
            print "Please enter a valid number\n"
        else:
            return Number

class decToBinary():
    Binary_Converter = 128
    i = 0
    Binary = 0
    while True:
        Number = gimmeANumber()
        ONumber = Number
        while (true):
            if (Number - Binary_Converter) &gt;= 0:
                Number =- Binary_Converter
                Binary_Converter /= 2
                Binary += 10**7-i
            else:
                Binary_Converter /= 2
            i += 1
            if i == 8:
                break
    print "\nThe origanal number was " + str(ONumber) + " Now it is " + str(Binary) + " in Binary.\n"
</code></pre>
