title: Why when I use slices with for loops it does not loop with only the items sliced?
body: <p>I am very new to python and programming in general and I am trying to solve a problem where I have to make a function that adds &quot;commas&quot; and &quot;and&quot; to a list.But I can not use slices with for loops and I can not understand why.</p>
  <pre><code>c = [&quot;x&quot;, &quot;y&quot;, &quot;z&quot;]
  def fu(l):
      g = &quot;&quot;
      for i in l[0:-1]:
          g = str(l) + &quot;, &quot;
          return g
  print(fu(c))
  </code></pre>
  <p>What I expected from this code was to return:
  x,y z</p>
  <p>But I got:
  ['x', 'y', 'z'],</p>