title: I have two question in python grammar. for loop and while loop
body: <pre><code>from typing import List  
  
  def dailyTemperatures(temperatures: List[int]) -&gt; List[int]:
      temp_count = len(temperatures)
      ans = [0]*temp_count
      
      stack = []
      idx_stack = []
      
      for idx in range(temp_count-1,-1,-1): // first point
        temperature = temperatures[idx]
        
        last_temp_idx = 0
        while stack: // second point
          last_temp = stack[-1]
          last_temp_idx = idx_stack[-1]
          if last_temp &lt;= temperature:
            stack.pop()
            idx_stack.pop()
          else:
            break
        
        if len(stack) == 0:
          stack.append(temperature)
          idx_stack.append(idx)
          ans[idx] = 0
          continue
          
        stack.append(temperature)
        idx_stack.append(idx)
        ans[idx] = last_temp_idx-idx
      
      return ans
  </code></pre>
  <p>I have two question. I've just started learning python.
  I googled but couldn't find an answer.
  first point &gt; (temp_count-1,-1,-1)
  I'm not sure what this sentence means.
  Does this mean decrement by one? Why are there two -1?</p>
  <p>second point &gt; while stack:
  Does this sentence mean that when stack is empty is operate?</p>