title: python: how do I do simple variable declaration?
body: <p>My code is test I'm trying to do to figure out why <code>p &amp; ~(p &amp; (p - 1))</code> won't test for exponents of 2. anyway, the interpreter doesn't like <code>in  = 1</code> before the while loop for some reason.</p>
  
  <p>code:</p>
  
  <pre><code>def getnumber(str):
      num=0
      for i in str:
          zz = ord(i)-48
          if zz&lt;0 or zz&gt;9:
              num=-1
              break
          else:
              num=(num*10)+zz
      return num
  
  def testexp2(p):
      table = {1:1,2:2,4:3,8:4,16:5,32:6,64:7,128:8,256:9}
      if p &amp; ~(p &amp; (p - 1)):
          print "yes"
      else:
          print "no"
  
  
  in = 1
  while in is not -1:
      in = raw_input("&gt; ")
      in = getnumber(in)
      if in&gt;-1:
          testexp2(in)
      else:
          print "\nDone\n\n"
  </code></pre>