title: How can I write code to change the index variable to skip over already tested values?
body: <p>I'm trying to write a code to, when given a list of integers, return the largest integer. How can I wrote code so, for example, if value a is greater than b, but c is greater than b, then we can infer c is greater than b? I want to do this in python.</p>
  <pre><code>def max(int_list: list[int]) -&gt; int:
  &quot;&quot;&quot;When list is empty, result in ValueError.&quot;&quot;&quot;
  if len(int_list) == 0:
      raise ValueError(&quot;max() arg is an empty List&quot;)
  #if there are no values in list, return ValueError
  
  i: int_list = 0
  num_at_index: int_list[i]
  num_at_alt_index = int_list[i + 1]
  max_value: int = 0
  
  while len(int_list) &gt; 0 and i &lt; len(int_list):
      if num_at_index &gt; num_at_alt_index:
          num_at_index = max_value
          i += 1
  
      else: 
          max_value = num_at_alt_index
          i += 1
  </code></pre>
  <p>Here is my code so far, I'm having a hard time figuring out where I can implement this (also, if anyone sees anything off about my code so far, please let me know).</p>