Python | String with For Loop




String With For Loop

    A loop is block of code that is continually repeated until a certain  condition is True

Example - 1


    A = "Python"

    for x in A :

            print(A)

Output

        P
        y
        t
        h
        o
        n        



Index based For loop

Example - 2

    str = "python"

    for x in range(0,len(str)):
          print(str[x], end='') 


Output

    python

Also See

Post a Comment (0)
Previous Post Next Post