Can I include a for loop inside my print statement?
<p>I have a list of winners of an event. I want to print them out at the end of my code, minus the brackets and quotes, and I am currently using:</p>

<pre><code>            for items in winners:
                print(items)
</code></pre>

<p>Can I include this in a print statement?
I want:</p>

<pre><code>            print("The winners of {} were: {} with a score of {}".format(sport, winners, max_result))
</code></pre>

<p>Is there a way of integrating the for loop into the print statement, or another way of eliminating the quotes and square brackets such that I can include it in the statement?</p>

<p>Thanks.</p>

<p>You can't include a for loop but you can join your list of winners into a string.</p>

<pre><code>winners = ['Foo', 'Bar', 'Baz']
print('the winners were {}.'.format(', '.join(winners)))
</code></pre>

<p>This would print</p>

<blockquote>
  <p>the winners were Foo, Bar, Baz.</p>
</blockquote>

python python-3.x