In my quest to solve a dictionary issue I had, I came across this simple function for generating random numbers.
import random
a = random.randint(1,10)
print('string_{}'.format(a))
This works great, but what I really needed is a function that does exactly that, but for consecutive numbers, i.e that goes 1,2,3,4,5...
I know of generators, iterators, while counters, using for loops, but I was looking for this kind of simple solution: something that will do the same action as the random function but for consecutive numbers.
Do you know if that option exists?
EDIT:
Thanks for all of the responders, but I am trying to find an easy one liners
like this a = random.randint(1,10)
but for consecutive numbers (i.e not random)