title: Exponential function return problem -python
body: <p>I am working on this problem - </p>
  
  <pre><code> modify powerOfTwo() to meet the conditions below
  #    - accept 1 integer parameter; an exponent
  #    - print to the screen 2 raised to the exponent argument, example:
  #    --- "2 to the power of 2 is 4"
  #    - also return the result (for the example, you would return 4)
  </code></pre>
  
  <p>my code is as follows:</p>
  
  <pre><code>def powerOfTwo(exp):
      x = int(input("please enter a number for what power of 2: "))
      e = (2**x)
      print("2 to the power of",x, "is: ",e,)
  
  
  
      return (2**x)
  </code></pre>
  
  <p>When running the program, my professor's code checks my code for accuracy, and I believe it is checking it incorrectly. The program returns the following, which includes my own input of "5":</p>
  
  <pre><code>please enter a number for what power of 2: 5
  2 to the power of 5 is:  32
  +3 function call w/ correct # of params is present
  +2 return value is correct type: &lt;class 'int'&gt;
  -- return value is incorrect
  Expected:  64
  Returned:  32
  </code></pre>
  
  <p>The expected value, 64, is obviously incorrect. Is something wrong with my code, or with my professors code that is checking my problem? (included below):</p>
  
  <pre><code>q2s = 0
  e = random.randint(3,11)
  try:
      print("\nq2-1:  Checking powerOfTwo(" + str(e) + ")")
      p2 = powerOfTwo(e)
      print("+3 function call w/ correct # of params is present")
      score += 3
      q2s += 3
      if isinstance(p2, int):
          print("+2 return value is correct type:",type(p2))
          score += 2
          q2s += 2
          if p2 == (2 ** e):
              print("+2 return value is correct:",p2)
              score += 2
              q2s += 2
          else:
              print("-- return value is incorrect")
              print("Expected: ",2 ** e)
              print("Returned: ",p2)
  
          e = random.randint(12,22)
          print("\nq2-2:  Checking powerOfTwo(" + str(e) + ")")
          p2 = powerOfTwo(e)
          if p2 == (2**e):
              print("+2 return value is correct:",p2)
              score += 2
              q2s += 2
          else:
              print("-- return value is incorrect")
              print("Expected: ",2**e)
              print("Returned: ",p2)
      else:
          print("-- return value is incorrect type:",type(p2))
  except:
      print("**Something is wrong with powerOfTwo()")
      printErr()
  </code></pre>