Last step of the project: Is there a way to iterate through a list and print the results in the same print() statement?

I have successfully completed the Thread Shed project. But the way the last step was worded got me thinking: Is there a way to iterate through a list and print the results in the same print() statement?

For example, if I have two simple lists, one with a list of colours (called colours), and another with a list of counts that correspond to each colour (called counts), is there a way to print one sentence that says something like, “Today we sold counts[0] number of colours[0], counts[1] number of colours[1], counts[2] number of colours[2] …” etc, until whatever the length of colours is?

All in one single setence?

You can have a holder sentence be empty, and as you iterate you append new sentences to that holder.

Then you can just print(holder) and you have your long string.

1 Like

Ah, this makes sense. Thank you!