title: Indexing a list
body: <pre><code>from typing import List
  
  def up_to_keyword(items: List[str], keyword: str) -&gt; List[str]:
  """Return a new list that contains only the items that occur before keyword
  in items, or all items if keyword is not an element of items.  Do not
  include keyword in your result.
  """
  
      n_list = []
      if keyword not in items:
          return items
      else:
          for i in range(len(items)):
              if items.index(i) &lt; items.index(keyword):
                  return n_list.append(i)
  </code></pre>
  
  <p>How would I go about coding the case where the keyword exists in the list? Is my code close to satisfying the given conditions?</p>