About 85,000 results
Open links in new tab
  1. Traversing a String in Python - Python4U

    Jul 25, 2022 · We can iterate or traverse over a string using a ‘while’ loop. We provide the string’s length using the len () function for iterating over a string. In the while loop, the upper limit is …

  2. Iterate over characters of a string in Python - GeeksforGeeks

    Oct 27, 2024 · In this article, we will learn how to iterate over the characters of a string in Python. There are several methods to do this, but we will focus on the most efficient one. The simplest …

  3. 1. String Index, Length, Slicing and Traversal

    Explore string operators, index values, length of strings, string slicing, and traversing a string using a for loop (by item).

  4. How to Iterate Through a String in Python? - Python Guides

    Jan 28, 2025 · Learn how to iterate through a string in Python using loops like for and while, enumerate(), and list comprehensions. Includes examples and tips for beginners.

  5. Python Strings (With Examples) - Programiz

    In Python, a string is a sequence of characters. For example, "hello" is a string containing a sequence of characters 'h', 'e', 'l', 'l', and 'o'. We use single quotes or double quotes to …

  6. 7.3. Traversal through a string with a loop — Python for …

    One way to write a traversal is with a while loop: Customize visualization (NEW!) This loop traverses the string and displays each letter on a line by itself. The loop condition is index < …

  7. Python: Traversing Strings - Code Basics

    Python: Traversing Strings. Loops are used to work with strings as well as numbers. For example, you can get a specific character by its index, and also form strings in loops. Below is some …

  8. Python String: Working With Text • Python Land Tutorial

    Mar 14, 2025 · Learn what a Python string is, how to create strings, which quotes to use when creating them, and how to perform operations on a string.

  9. How to traverse a String in Python? - Iteration in Pythoin

    Dec 13, 2024 · How to traverse a String in Python? - Iteration in Pythoin. Last updated at Dec. 13, 2024 by Teachoo. In the above code, the loop starts from the first character of the string str1 …

  10. Python: Traversing a string, checking its element, and inputting ...

    Sep 16, 2009 · I have a function that returns an 8 digit long binary string for given parameter: I want to traverse each index of this string and check if it is a zero or a one. I tried to write a …

  11. Some results have been removed
Refresh