I'm exercising dictionaries therefore I have the following
favorite_place = {
'ppl1': {
'person': 'josh',
'places': ['Central park', 'Hollywood', 'Aspan']
},
'ppl2': {
'person': 'mark',
'places': ['Ands mountain', 'Himalaya mountain', 'Dead sea']
},
'ppl3': {
'person': 'yossi',
'places': ['times square', 'Osaka', ',McDonald\'s']
},
}
for budy, places_info in favorite_place.items():
ID = f"{budy}"
PERSON_NAME = f"{places_info['person']}"
PLACES = f"{places_info['places']}"
print(f"\nPerson Identified by: {ID}\n"f"For {PERSON_NAME.title()}")
print(f"The favorite places are:\n"f"\t",str(PLACES).strip('[]').replace('\'', ''))
output:
..................... ..................
Person Identified by: ppl3
For Yossi
The favorite places are:
times square, Osaka, ", McDonald's"
How do I take this, for example:
times square, Osaka, McDonalds
and make it to be like this -separated by a new line and with out the a comma??? :
times square
Osaka
McDonalds