ExampleGet your own Python Server Print each adjective for every fruit: adj = ["red", "big", "tasty"]fruits = ["apple", "banana", "cherry"] for x in adj: for y in fruits: print(x, y) Try it Yourself » Related Pages Python For Loops Tutorial For Loop Through a String For...
Track your progress - it's free! Log in Sign Up COLOR PICKER PLUS SPACES GET CERTIFIED FOR TEACHERS FOR BUSINESS CONTACT US Top Tutorials HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ ...
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
ExampleGet your own Python Server Print i as long as i is less than 6: i =1 whilei <6: print(i) i +=1 Try it Yourself » Note:remember to increment i, or else the loop will continue forever. Thewhileloop requires relevant variables to be ready, in this example we need to def...
ExampleGet your own Python Server Print each fruit in a fruit list: fruits = ["apple","banana","cherry"] forxinfruits: print(x) Try it Yourself » Theforloop does not require an indexing variable to set beforehand. Looping Through a String ...
for x in [0, 1, 2]: pass Try it Yourself » Related Pages Python For Loops Tutorial For Loop Through a String For Break For Continue Looping Through a rangee For Else Nested Loops ❮ Python Glossary Track your progress - it's free! Log in Sign Up COLOR...