@ccc your right. When I made the body of the function I was imagining 3 dials with the numbers 0 through 9 and as they rotate when first dial hit 9 the next dial would click over to 1 and the first dial change to 0. Like an odometer. I figured it out but I see now all I need is <999 += 1.

I was watching a video and thinking of what you recommended and came up with this

def patient_id_gen(): ''' generates patient id one at a time as patient object is created ''' prefix = 'AD' for i in range(1000,9999): yield f"{prefix}{i}"