title: How to remove unwanted commas from a python list
body: <p>I'm doing an exercise from a python for beginners book. The project I'm stuck on is as follows: "Write a function that takes in a list of value as an argument and returns a string with all the items separated by comma and a space. Your function should be able to work with any list values passed to it"</p>
  
  <p>Here is my code:</p>
  
  <pre><code>def passInList(spam):
         for x in range(len(spam)):
             z = spam[x] + ', ' 
             print(z,end= ' ')
  
  spam=['apples', 'bananas', 'tofu', 'and cats']
  passInList(spam)
  </code></pre>
  
  <p><strong>Expected output</strong> is - 'apples, bananas, tofu, and cats'.</p>
  
  <p><strong>My output</strong> is- 'apples, bananas, tofu, and cats,'</p>
  
  <p>The issue I'm having, is that I can't seems to get rid of the comma at the end of "cats".  </p>
  
  <p>Thanks for suggestions.</p>