René's URL Explorer Experiment


Title: Python for Loops: The Pythonic Way – Real Python

Open Graph Title: Python for Loops: The Pythonic Way – Real Python

Description: In this tutorial, you'll learn all about the Python for loop. You'll learn how to use this loop to iterate over built-in data types, such as lists, tuples, strings, and dictionaries. You'll also explore some Pythonic looping techniques and much more.

Open Graph Description: In this tutorial, you'll learn all about the Python for loop. You'll learn how to use this loop to iterate over built-in data types, such as lists, tuples, strings, and dictionaries. You'll also explore some Pythonic looping techniques and much more.

Mail addresses
?subject=Python article for you&body=Python for Loops: The Pythonic Way on Real Python https://realpython.com/python-for-loop/

Opengraph URL: https://realpython.com/python-for-loop/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
{
  "@context": "http://schema.org",
  "@type": "Article",
  "headline": "Python for Loops: The Pythonic Way",
  "image": {
    "@type": "ImageObject",
    "url": "https://files.realpython.com/media/UPDATE-Python-for-Loops-Definite-Iteration_Watermarked.32bfd8825dfe.jpg",
    "width": 1920,
    "height": 1080
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://realpython.com/python-for-loop/",
    "lastReviewed": "2025-02-03",
    "author": {
      "@type": "Person",
      "name": "Leodanis Pozo Ramos",
      "image": "https://realpython.com/cdn-cgi/image/width=862,height=862,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Perfil_final1.9f896bc212f6.jpg",
      "url": "https://realpython.com/team/lpozoramos/",
      "affiliation": {
        "@type": "Organization",
        "@id": "https://realpython.com/#organization",
        "name": "Real Python",
        "url": "https://realpython.com",
        "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
      }
    },
    "reviewedBy": [
      {
        "@type": "Person",
        "name": "Aldren Santos",
        "image": "https://realpython.com/cdn-cgi/image/width=500,height=500,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Aldren_Santos_Real_Python.6b0861d8b841.png",
        "url": "https://realpython.com/team/asantos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Brenda Weleschuk",
        "image": "https://realpython.com/cdn-cgi/image/width=320,height=320,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/IMG_3324_1.50b309355fc1.jpg",
        "url": "https://realpython.com/team/bweleschuk/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "David Amos",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/me-small.f5f49f1c48e1.jpg",
        "url": "https://realpython.com/team/damos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Geir Arne Hjelle",
        "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/gahjelle.470149ee709e.jpg",
        "url": "https://realpython.com/team/gahjelle/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Joanna Jablonski",
        "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/jjablonksi-avatar.e37c4f83308e.jpg",
        "url": "https://realpython.com/team/jjablonski/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "John Sturtz",
        "image": "https://realpython.com/cdn-cgi/image/width=1920,height=1920,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/real-python-logo-square.28474fda9228_1.146e987bf77c.png",
        "url": "https://realpython.com/team/jsturtz/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Martin Breuss",
        "image": "https://realpython.com/cdn-cgi/image/width=456,height=456,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/martin_breuss_python_square.efb2b07faf9f.jpg",
        "url": "https://realpython.com/team/mbreuss/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      }
    ]
  },
  "datePublished": "2025-02-03T14:00:00+00:00",
  "dateModified": "2025-02-03T14:09:19.654278+00:00",
  "publisher": {
    "@type": "Organization",
    "@id": "https://realpython.com/#organization",
    "name": "Real Python",
    "url": "https://realpython.com",
    "logo": {
      "@type": "ImageObject",
      "url": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png",
      "width": 512,
      "height": 512
    },
    "description": "Real Python is a leading provider of online Python education and one of the largest language-specific online communities for software developers. It publishes high-quality learning resources, such as tutorials, books, and courses to an audience of millions of developers, data scientists, and machine learning engineers each month.",
    "slogan": "Become a Python Expert",
    "email": "info@realpython.com",
    "sameAs": [
      "https://github.com/realpython",
      "https://www.youtube.com/realpython",
      "https://twitter.com/realpython",
      "https://x.com/realpython",
      "https://www.linkedin.com/company/realpython-com/",
      "https://www.facebook.com/learnrealpython",
      "https://www.instagram.com/realpython",
      "https://www.tiktok.com/@realpython.com"
    ]
  },
  "author": {
    "@type": "Person",
    "name": "Leodanis Pozo Ramos",
    "image": "https://realpython.com/cdn-cgi/image/width=862,height=862,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Perfil_final1.9f896bc212f6.jpg",
    "url": "https://realpython.com/team/lpozoramos/",
    "affiliation": {
      "@type": "Organization",
      "@id": "https://realpython.com/#organization",
      "name": "Real Python",
      "url": "https://realpython.com",
      "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
    }
  },
  "description": "In this tutorial, you'll learn all about the Python for loop. You'll learn how to use this loop to iterate over built-in data types, such as lists, tuples, strings, and dictionaries. You'll also explore some Pythonic looping techniques and much more.",
  "hasPart": {
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "How do you use a for loop to iterate over a list in Python?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "

You use a for loop to iterate over a list by specifying the loop variable and the list. For example, for item in a_list: allows you to process each item in a_list.

" } }, { "@type": "Question", "name": "What\u2019s the difference between an iterable and an iterator in Python?", "acceptedAnswer": { "@type": "Answer", "text": "

An iterable is an object capable of returning its members one at a time, while an iterator is an object that represents a stream of data, returning the next item with a .__next__() special method.

" } }, { "@type": "Question", "name": "How can you iterate over both keys and values in a dictionary?", "acceptedAnswer": { "@type": "Answer", "text": "

You can iterate over both keys and values in a dictionary using the .items() method in a for loop, like for key, value in a_dict.items():.

" } }, { "@type": "Question", "name": "What happens if you try to modify a list while iterating over it?", "acceptedAnswer": { "@type": "Answer", "text": "

If you modify a list while iterating over it, you may encounter unexpected behavior, such as skipping elements or runtime errors. It’s recommended to iterate over a copy of the list instead. In some cases, it’s necessary to create a new list to keep the result.

" } }, { "@type": "Question", "name": "How do you handle exceptions in a for loop to ensure it doesn\u2019t terminate prematurely?", "acceptedAnswer": { "@type": "Answer", "text": "

To handle exceptions in a for loop, wrap the code that might raise an exception in a try block. Then use an except block to catch the exception, manage the error, and continue the iteration.

" } } ] } }

authorReal Python
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/UPDATE-Python-for-Loops-Definite-Iteration_Watermarked.32bfd8825dfe.jpg
og:imagehttps://files.realpython.com/media/UPDATE-Python-for-Loops-Definite-Iteration_Watermarked.32bfd8825dfe.jpg
twitter:creator@realpython
og:typearticle

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/python-for-loop
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/quizzes/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Code Mentor →BetaPersonalized code assistance & learning toolshttps://realpython.com/mentor/
Unlock All Content →https://realpython.com/account/join/
More https://realpython.com/python-for-loop
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Tutorial Writerhttps://realpython.com/write-for-us/
Become a Video Instructorhttps://realpython.com/become-an-instructor/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?next=%2Fpython-for-loop%2F
Browse Topicshttps://realpython.com/tutorials/all/
Guided Learning Pathshttps://realpython.com/learning-paths/
Basicshttps://realpython.com/search?level=basics
Intermediatehttps://realpython.com/search?level=intermediate
Advancedhttps://realpython.com/search?level=advanced
aihttps://realpython.com/tutorials/ai/
algorithmshttps://realpython.com/tutorials/algorithms/
apihttps://realpython.com/tutorials/api/
best-practiceshttps://realpython.com/tutorials/best-practices/
careerhttps://realpython.com/tutorials/career/
communityhttps://realpython.com/tutorials/community/
databaseshttps://realpython.com/tutorials/databases/
data-sciencehttps://realpython.com/tutorials/data-science/
data-structureshttps://realpython.com/tutorials/data-structures/
data-vizhttps://realpython.com/tutorials/data-viz/
devopshttps://realpython.com/tutorials/devops/
djangohttps://realpython.com/tutorials/django/
dockerhttps://realpython.com/tutorials/docker/
editorshttps://realpython.com/tutorials/editors/
flaskhttps://realpython.com/tutorials/flask/
front-endhttps://realpython.com/tutorials/front-end/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
machine-learninghttps://realpython.com/tutorials/machine-learning/
newshttps://realpython.com/tutorials/news/
numpyhttps://realpython.com/tutorials/numpy/
projectshttps://realpython.com/tutorials/projects/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
testinghttps://realpython.com/tutorials/testing/
toolshttps://realpython.com/tutorials/tools/
web-devhttps://realpython.com/tutorials/web-dev/
web-scrapinghttps://realpython.com/tutorials/web-scraping/
Table of Contentshttps://realpython.com/python-for-loop#toc
Getting Started With the Python for Loophttps://realpython.com/python-for-loop#getting-started-with-the-python-for-loop
Traversing Built-in Collections in Pythonhttps://realpython.com/python-for-loop#traversing-built-in-collections-in-python
Sequences: Lists, Tuples, Strings, and Rangeshttps://realpython.com/python-for-loop#sequences-lists-tuples-strings-and-ranges
Collections: Dictionaries and Setshttps://realpython.com/python-for-loop#collections-dictionaries-and-sets
Using Advanced for Loop Syntaxhttps://realpython.com/python-for-loop#using-advanced-for-loop-syntax
The break Statementhttps://realpython.com/python-for-loop#the-break-statement
The continue Statementhttps://realpython.com/python-for-loop#the-continue-statement
The else Clausehttps://realpython.com/python-for-loop#the-else-clause
Nested for Loopshttps://realpython.com/python-for-loop#nested-for-loops
Exploring Pythonic Looping Techniqueshttps://realpython.com/python-for-loop#exploring-pythonic-looping-techniques
Iterating With Indices: The Pythonic Wayhttps://realpython.com/python-for-loop#iterating-with-indices-the-pythonic-way
Looping Over Several Iterables in Parallelhttps://realpython.com/python-for-loop#looping-over-several-iterables-in-parallel
Iterating Over Multiple Iterables Sequentiallyhttps://realpython.com/python-for-loop#iterating-over-multiple-iterables-sequentially
Repeating Actions a Predefined Number of Timeshttps://realpython.com/python-for-loop#repeating-actions-a-predefined-number-of-times
Iterating Over Reversed and Sorted Iterableshttps://realpython.com/python-for-loop#iterating-over-reversed-and-sorted-iterables
Understanding Common Pitfalls in for Loopshttps://realpython.com/python-for-loop#understanding-common-pitfalls-in-for-loops
Modifying the Loop Collectionhttps://realpython.com/python-for-loop#modifying-the-loop-collection
Changing the Loop Variablehttps://realpython.com/python-for-loop#changing-the-loop-variable
Ignoring Possible Exceptionshttps://realpython.com/python-for-loop#ignoring-possible-exceptions
Using for Loops vs Comprehensionshttps://realpython.com/python-for-loop#using-for-loops-vs-comprehensions
Using async for Loops for Asynchronous Iterationhttps://realpython.com/python-for-loop#using-async-for-loops-for-asynchronous-iteration
Conclusionhttps://realpython.com/python-for-loop#conclusion
Frequently Asked Questionshttps://realpython.com/python-for-loop#frequently-asked-questions
https://realpython.com/feedback/survey/article/python-for-loop/liked/?from=article-sidebar
https://realpython.com/feedback/survey/article/python-for-loop/disliked/?from=article-sidebar
For Loops in Python (Definite Iteration) 16m · 4 lessons https://realpython.com/courses/python-for-loop/
Leodanis Pozo Ramoshttps://realpython.com/python-for-loop#author
https://realpython.com/python-for-loop#reader-comments
intermediatehttps://realpython.com/tutorials/intermediate/
best-practiceshttps://realpython.com/tutorials/best-practices/
pythonhttps://realpython.com/tutorials/python/
Getting Started With the Python for Loophttps://realpython.com/python-for-loop#getting-started-with-the-python-for-loop
Traversing Built-in Collections in Pythonhttps://realpython.com/python-for-loop#traversing-built-in-collections-in-python
Sequences: Lists, Tuples, Strings, and Rangeshttps://realpython.com/python-for-loop#sequences-lists-tuples-strings-and-ranges
Collections: Dictionaries and Setshttps://realpython.com/python-for-loop#collections-dictionaries-and-sets
Using Advanced for Loop Syntaxhttps://realpython.com/python-for-loop#using-advanced-for-loop-syntax
The break Statementhttps://realpython.com/python-for-loop#the-break-statement
The continue Statementhttps://realpython.com/python-for-loop#the-continue-statement
The else Clausehttps://realpython.com/python-for-loop#the-else-clause
Nested for Loopshttps://realpython.com/python-for-loop#nested-for-loops
Exploring Pythonic Looping Techniqueshttps://realpython.com/python-for-loop#exploring-pythonic-looping-techniques
Iterating With Indices: The Pythonic Wayhttps://realpython.com/python-for-loop#iterating-with-indices-the-pythonic-way
Looping Over Several Iterables in Parallelhttps://realpython.com/python-for-loop#looping-over-several-iterables-in-parallel
Iterating Over Multiple Iterables Sequentiallyhttps://realpython.com/python-for-loop#iterating-over-multiple-iterables-sequentially
Repeating Actions a Predefined Number of Timeshttps://realpython.com/python-for-loop#repeating-actions-a-predefined-number-of-times
Iterating Over Reversed and Sorted Iterableshttps://realpython.com/python-for-loop#iterating-over-reversed-and-sorted-iterables
Understanding Common Pitfalls in for Loopshttps://realpython.com/python-for-loop#understanding-common-pitfalls-in-for-loops
Modifying the Loop Collectionhttps://realpython.com/python-for-loop#modifying-the-loop-collection
Changing the Loop Variablehttps://realpython.com/python-for-loop#changing-the-loop-variable
Ignoring Possible Exceptionshttps://realpython.com/python-for-loop#ignoring-possible-exceptions
Using for Loops vs Comprehensionshttps://realpython.com/python-for-loop#using-for-loops-vs-comprehensions
Using async for Loops for Asynchronous Iterationhttps://realpython.com/python-for-loop#using-async-for-loops-for-asynchronous-iteration
Conclusionhttps://realpython.com/python-for-loop#conclusion
Frequently Asked Questionshttps://realpython.com/python-for-loop#frequently-asked-questions
Remove adshttps://realpython.com/account/join/
For Loops in Python (Definite Iteration)https://realpython.com/courses/python-for-loop/
Click here to download the free sample codehttps://realpython.com/bonus/python-for-loop-code/
https://realpython.com/quizzes/python-for-loop/
Python for Loops: The Pythonic Wayhttps://realpython.com/quizzes/python-for-loop/
https://realpython.com/python-for-loop#getting-started-with-the-python-for-loop
for loopshttps://en.wikipedia.org/wiki/For_loop
while loopshttps://realpython.com/python-while-loop/
compound statementshttps://docs.python.org/3/reference/compound_stmts.html
print()https://realpython.com/python-print/
Pythonichttps://realpython.com/learning-paths/writing-pythonic-code/
iterablehttps://realpython.com/python-iterators-iterables/#getting-to-know-python-iterables
listshttps://realpython.com/python-list/
tupleshttps://realpython.com/python-tuple/
stringshttps://realpython.com/python-strings/
dictionarieshttps://realpython.com/python-dicts/
setshttps://realpython.com/python-sets/
special methodhttps://realpython.com/python-magic-methods/
Iterators and Iterables in Python: Run Efficient Iterationshttps://realpython.com/python-iterators-iterables/
unpackhttps://realpython.com/python-tuple/#packing-and-unpacking-tuples
dictionaryhttps://realpython.com/python-for-loop#collections-dictionaries-and-sets
parallel iterationhttps://realpython.com/python-for-loop#looping-over-several-iterables-in-parallel
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-for-loop#traversing-built-in-collections-in-python
https://realpython.com/python-for-loop#sequences-lists-tuples-strings-and-ranges
Python’s list Data Type: A Deep Dive With Exampleshttps://realpython.com/python-list/
Python’s tuple Data Type: A Deep Dive With Exampleshttps://realpython.com/python-tuple/
Strings and Character Data in Pythonhttps://realpython.com/python-strings/
Python range(): Represent Numerical Rangeshttps://realpython.com/python-range/
iterate a given number of timeshttps://realpython.com/python-for-loop#repeating-actions-a-predefined-number-of-times
https://realpython.com/python-for-loop#collections-dictionaries-and-sets
How to Iterate Through a Dictionary in Pythonhttps://realpython.com/iterate-through-dictionary-python/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-for-loop#using-advanced-for-loop-syntax
https://realpython.com/python-for-loop#the-break-statement
https://realpython.com/python-for-loop#the-continue-statement
https://realpython.com/python-for-loop#the-else-clause
https://realpython.com/python-for-loop#nested-for-loops
nested loopshttps://realpython.com/nested-loops-python/
format specifierhttps://realpython.com/python-formatted-output/#format-specifiers-and-their-components
print()https://realpython.com/ref/builtin-functions/print/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-for-loop#exploring-pythonic-looping-techniques
https://realpython.com/python-for-loop#iterating-with-indices-the-pythonic-way
enumerate()https://realpython.com/ref/builtin-functions/enumerate/
range()https://realpython.com/ref/builtin-types/range/
Python enumerate(): Simplify Loops That Need Countershttps://realpython.com/python-enumerate/
https://realpython.com/python-for-loop#looping-over-several-iterables-in-parallel
zip()https://realpython.com/ref/builtin-functions/zip/
Using the Python zip() Function for Parallel Iterationhttps://realpython.com/python-zip-function/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-for-loop#iterating-over-multiple-iterables-sequentially
chain()https://docs.python.org/3/library/itertools.html#itertools.chain
Python itertools By Examplehttps://realpython.com/python-itertools/
flattenshttps://realpython.com/python-flatten-list/
nested loophttps://realpython.com/python-for-loop#nested-for-loops
https://realpython.com/python-for-loop#repeating-actions-a-predefined-number-of-times
Pennyhttps://en.wikipedia.org/wiki/Penny_%28The_Big_Bang_Theory%29
Sheldonhttps://en.wikipedia.org/wiki/Sheldon_Cooper
underscorehttps://realpython.com/python-double-underscore/
https://realpython.com/python-for-loop#iterating-over-reversed-and-sorted-iterables
reversed()https://realpython.com/ref/builtin-functions/reversed/
sorted()https://realpython.com/ref/builtin-functions/sorted/
Reverse Python Lists: Beyond .reverse() and reversed()https://realpython.com/python-reverse-list/
Reverse Strings in Python: reversed(), Slicing, and Morehttps://realpython.com/reverse-string-python/
How to Use sorted() and .sort() in Pythonhttps://realpython.com/python-sort/
Sorting a Python Dictionary: Values, Keys, and Morehttps://realpython.com/sort-python-dictionary/
lambdahttps://realpython.com/python-lambda/
f-stringhttps://realpython.com/python-f-strings/
format specifierhttps://realpython.com/python-formatted-output/#format-specifiers-and-their-components
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-for-loop#understanding-common-pitfalls-in-for-loops
https://realpython.com/python-for-loop#modifying-the-loop-collection
ValueErrorhttps://realpython.com/python-built-in-exceptions/#valueerror
.append()https://realpython.com/python-append/
.copy()https://docs.python.org/3/library/stdtypes.html#dict.copy
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-for-loop#changing-the-loop-variable
https://realpython.com/python-for-loop#ignoring-possible-exceptions
https://realpython.com/python-for-loop#using-for-loops-vs-comprehensions
When to Use a List Comprehension in Pythonhttps://realpython.com/list-comprehension-python/
Python Dictionary Comprehensions: How and When to Use Themhttps://realpython.com/python-dictionary-comprehension/
Python Set Comprehensions: How and When to Use Themhttps://realpython.com/python-set-comprehension/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-for-loop#using-async-for-loops-for-asynchronous-iteration
Asynchronous Iterators and Iterables in Pythonhttps://realpython.com/python-async-iterators/
run this scripthttps://realpython.com/run-python-scripts/
https://realpython.com/python-for-loop#conclusion
Click here to download the free sample codehttps://realpython.com/bonus/python-for-loop-code/
https://realpython.com/python-for-loop#frequently-asked-questions
https://realpython.com/quizzes/python-for-loop/
Python for Loops: The Pythonic Wayhttps://realpython.com/quizzes/python-for-loop/
https://realpython.com/feedback/survey/article/python-for-loop/liked/?from=article-footer
https://realpython.com/feedback/survey/article/python-for-loop/disliked/?from=article-footer
For Loops in Python (Definite Iteration)https://realpython.com/courses/python-for-loop/
https://realpython.com/team/lpozoramos/
» More about Leodanishttps://realpython.com/team/lpozoramos/
https://realpython.com/team/asantos/
Aldrenhttps://realpython.com/team/asantos/
https://realpython.com/team/bweleschuk/
Brendahttps://realpython.com/team/bweleschuk/
https://realpython.com/team/damos/
Davidhttps://realpython.com/team/damos/
https://realpython.com/team/gahjelle/
Geir Arnehttps://realpython.com/team/gahjelle/
https://realpython.com/team/jjablonski/
Joannahttps://realpython.com/team/jjablonski/
https://realpython.com/team/jsturtz/
Johnhttps://realpython.com/team/jsturtz/
https://realpython.com/team/mbreuss/
Martinhttps://realpython.com/team/mbreuss/
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=python-for-loop
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=python-for-loop
https://realpython.com/feedback/survey/article/python-for-loop/liked/?from=article-comments
https://realpython.com/feedback/survey/article/python-for-loop/disliked/?from=article-comments
LinkedInhttps://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Frealpython.com%2Fpython-for-loop%2F
Twitterhttps://twitter.com/intent/tweet/?text=Interesting%20Python%20article%20on%20%40realpython%3A%20Python%20for%20Loops%3A%20The%20Pythonic%20Way&url=https%3A%2F%2Frealpython.com%2Fpython-for-loop%2F
Blueskyhttps://bsky.app/intent/compose?text=Interesting%20Python%20article%20on%20%40realpython.com%3A%20Python%20for%20Loops%3A%20The%20Pythonic%20Way%20https%3A%2F%2Frealpython.com%2Fpython-for-loop%2F
Facebookhttps://facebook.com/sharer/sharer.php?u=https%3A%2F%2Frealpython.com%2Fpython-for-loop%2F
Get tips for asking good questionshttps://realpython.com/python-beginner-tips/#tip-9-ask-good-questions
get answers to common questions in our support portalhttps://support.realpython.com
Real Python Community Chathttps://realpython.com/community/
“Office Hours” Live Q&A Sessionhttps://realpython.com/office-hours/
intermediatehttps://realpython.com/tutorials/intermediate/
best-practiceshttps://realpython.com/tutorials/best-practices/
pythonhttps://realpython.com/tutorials/python/
For Loops in Python (Definite Iteration)https://realpython.com/courses/python-for-loop/?utm_source=realpython&utm_medium=web&utm_campaign=related-course&utm_content=python-for-loop
Python Exceptions: An Introductionhttps://realpython.com/python-exceptions/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-for-loop
Python while Loops: Repeating Tasks Conditionallyhttps://realpython.com/python-while-loop/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-for-loop
Defining Your Own Python Functionhttps://realpython.com/defining-your-own-python-function/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-for-loop
How to Use Generators and yield in Pythonhttps://realpython.com/introduction-to-python-generators/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-for-loop
Iterators and Iterables in Python: Run Efficient Iterationshttps://realpython.com/python-iterators-iterables/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-for-loop
https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fpython-for-loop%2F
Continue »https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fpython-for-loop%2F
Sign-Inhttps://realpython.com/account/login/?next=/python-for-loop/
Start Herehttps://realpython.com/start-here/
Learning Resourceshttps://realpython.com/search
Code Mentorhttps://realpython.com/mentor/
Python Referencehttps://realpython.com/ref/
Python Cheat Sheethttps://realpython.com/cheatsheets/python/
Support Centerhttps://support.realpython.com/
Learning Pathshttps://realpython.com/learning-paths/
Quizzes & Exerciseshttps://realpython.com/quizzes/
Browse Topicshttps://realpython.com/tutorials/all/
Live Courseshttps://realpython.com/live/
Bookshttps://realpython.com/books/
Podcasthttps://realpython.com/podcasts/rpp/
Newsletterhttps://realpython.com/newsletter/
Community Chathttps://realpython.com/community/
Office Hourshttps://realpython.com/office-hours/
Learner Storieshttps://realpython.com/learner-stories/
Plans & Pricinghttps://realpython.com/account/join/
Team Planshttps://realpython.com/account/join-team/
For Businesshttps://realpython.com/account/join-team/inquiry/
For Schoolshttps://realpython.com/account/join-team/education-inquiry/
Reviewshttps://realpython.com/learner-stories/
About Ushttps://realpython.com/about/
Teamhttps://realpython.com/team/
Mission & Valueshttps://realpython.com/mission/
Editorial Guidelineshttps://realpython.com/editorial-guidelines/
Sponsorshipshttps://realpython.com/sponsorships/
Careershttps://realpython.workable.com
Press Kithttps://realpython.com/media-kit/
Merchhttps://realpython.com/merch
https://www.youtube.com/realpython
https://x.com/realpython
https://www.linkedin.com/company/realpython-com
https://www.facebook.com/LearnRealPython
https://github.com/realpython/
Privacy Policyhttps://realpython.com/privacy-policy/
Terms of Usehttps://realpython.com/terms/
Securityhttps://realpython.com/security/
Contacthttps://realpython.com/contact/
https://realpython.com/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.