Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
2 answers
71 views

How to append values to a list in a dictionary while using a while loop?

vacation_poll = {} name_prompt = "\nWhat is your name? " vacation_spot_prompt = "\nWhere would you like to go on vacation? " repeat_prompt = "\nWould you like to continue? (...
granttes's user avatar
0 votes
2 answers
383 views

How can I use a while loop to append a dictionary with an arbitrary number of keys and multiple values from user inputs

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(...
p--h's user avatar
  • 39
-1 votes
1 answer
923 views

Python: Add to existing dictionary value if key exists in while loop?

I have this code right now. current_assets = {} yes_list=["yes", "Yes", "y", "Y"] while create_bs in (yes_list): key=str(input("Enter a specific account.\nExamples: Checking Account ...
metincs's user avatar
  • 21
2 votes
1 answer
51 views

Python Why can my list only recognize one set of login details?

I tried making a login detail storing program that stores usernames and passwords. I managed to make it work partially where the login manages to recognise the 1st set of login details, however, my ...
Mistake1829's user avatar
0 votes
2 answers
45 views

How can i add a list to a list in a dictionary

I'm struggling to figure out whats going wrong here I'm trying to append this list to a dictionary key's list but I only ever get the last one. For example: pastmoves =['n','w','s','w'] moves = [1,0,...
S rick's user avatar
  • 44