Search code examples
for-looppythonenumerate

How do I get same result without using enumerate?


I do not need char in this example, but I include it to get my desired results.

charlist = [strval[0:count+1] for count, char in enumerate(strval)]

How do I get the same result without using enumerate?


Solution

  • xrange(len(strval))