Is something like that is according to your expectations:
print('Scenario Analysis')
profit_dict = {}
while True:
item1= input ('What is the item: ')
price_good= int (input('What is the expected profit of {}, in the best case scenario: '.format(item1)))
price_bad = int( input ('What is the expected profit of {}, in the worst case scenario: '.format(item1)))
if item1 in profit_dict.keys():
profit_dict[item1]['good'].append(price_good)
profit_dict[item1]['bad'].append(price_bad)
else:
profit_dict[item1]={'good':[price_good],'bad':[price_bad]}
user_choice= input('Do you have anymore items: ')
if user_choice in ['Yes','yes','y','Y']:
pass
else:
break
=> You will result with a dictionnary of dictionary:
{'Item1':{'good':[1,2,3], 'bad':[0,0,1]}, 'Item2':{'good':[10,20,30], 'bad':[1,2,3]}, ,...,'ItemX':{'good':[10,20,30], 'bad':[1,2,3]}}
And after you can try to call the print with something like:
print(f'This is your best profit outcome: {max(profit_dict[item]['good'])}')
print(f'This is your worst profit outcome: {min(profit_dict[item]['bad'])}')
EDIT:
Not sure do understand you comment:
if you are looking for a specific item:
item='item1'
print(f'This is your best profit outcome: {max(profit_dict[item]['good'])}')
if item is not known
you can explore the dictionnary by iteration:
for key, value in profit_dict.items():
for key2, value2 in value.items():
print(f"This is your best profit outcome for {key}:{max(profit_dict[item]['good'])}")
it will print you:
This is your best profit outcome for Item1:3
This is your best profit outcome for Item2:30
...
This is your best profit outcome for ItemX:30
And if you want to know the item with the bigger 'good' this solution is not the best but you can still do an iteration:
previous_best_value=0
for key, value in profit_dict.items():
for key2, value2 in value.items():
best_value=max(profit_dict[key]['good'])
if best_value>previous_best_value:
previous_best_value=best_value
best_item=key
print(f"The item:{key} has the best outcome {previous_best_value}")
Hope you will find what you expected.