Beginner programmer here. I have 2 questions.
Turn a list into a nested dictionary:
house_prices = ['£200k', '£300k', '£500k'`]
I want to turn it into--
House_price_dict = {
'house1': {'price':'£200k'},
'house2': {'price':'£300k'},
'house3': {'price:'£500k'},
}
Turn two lists into a nested dictionary:
house_prices = ['£200k', '£300k', '£500k'`]
no_of_bedrooms = [2, 3, 5]
I want to turn into--
house_info_dict = {
'house1': {
'price':'£200k',
'no_of_bedrooms':2,
},
'house2': {
'price':'£300k',
'no_of_bedrooms': 3,
},
'house3': {
'price:'£500k',
'no_of_bedrooms': 5,
},
}