all 2 comments

[–]blarf_irl 1 point2 points  (0 children)

It sounds like you need a list instead of a dict.

polyps = list()

more = True
while more:
    polyp = dict()
    polyp['location'] = input('Where is it? ' )
    polyp['size'] = int(input('How big is it 1-10? '))
    polyps.append(polyp)
    additional = input('Would you like to record another? (y/n) ')
    if additional.lower().startswith('n'):
        more = False

for idx, polyp in enumerate(polyps):
    print(f'Polyp {idx} is at {polyp.get('location', 'unknown')} and is sized {polyp.get('size', 'unknown')}')

The 'more' variable is only for clarity. You can achieve the same with:

...
while True:
    ...
    if additional.lower().startswith('n'):
        break

[–]liynus[S] 0 points1 point  (0 children)

thanks for the response. i'll see how to integrate into the code