ExampleGet your own Python Server Iterate through the items and print the values: thistuple = ("apple", "banana", "cherry") for x in thistuple: print(x) Try it Yourself » Learn more about for loops in our Python For Loops Chapter.Loop Through the Index Numbers...
for loops cannot be empty, but if you for some reason have a for loop with no content, put in the pass statement to avoid getting an error.ExampleGet your own Python Server for x in [0, 1, 2]: pass Try it Yourself »
And there are times you must use the print() function to output code, for example when working with for loops (which you will learn more about in a later chapter):Example for (x in 1:10) { print(x)} Try it Yourself » Conclusion: It is up to you whether you want to use ...