title: While condition in python going in Infinite loop
body: <p>Just wondering if someone can help me out with a small issue. The while condition works fine when I compare startNum with a constant (startNum &lt; 11) but goes to infinite loop when I compare with endNum. I am curious to understand what am I doing wrong here?</p>
  
  <h1>Code Snippet below</h1>
  
  <pre><code>startNum = 1
  endNum = raw_input('please enter the end number')
  def main():
  
          print startNum
          print endNum
          sumNatural()
          print listNumBoth
          print listNumThree
          print listNumFive
  
  
  
  
  def sumNatural():
  
      global startNum
      global endNum
      print startNum
      print endNum
  
      while startNum &lt; endNum:
          listNumThree=[]
  
          listNumBoth=[]
          listNumFive=[]
          #startNum=1
          #endNum=raw_input('please enter the end number')
          startNum = startNum+1
          print 'StartNUM ',startNum,'EndNum ',endNum
          if startNum%3==0 and startNum%5==0:
              listNumBoth.append(startNum)
  
          elif startNum%3==0:
              listNumThree.append(startNum)
          elif startNum%5==0:
              listNumFive.append(startNum)
          else:
              print 'number not divisible',startNum
      else:
          print 'while loop ended'
  
  main()
  </code></pre>