How do you convert the list in goldMedals
to this one in the code below
Welcome to Wolfram Community! Please make sure you know the rules: https://wolfr.am/READ-1ST
The rules explain how to format your code properly. Posting code Images doesn’t help other members to copy your code. Please EDIT your post and make sure code blocks start on a new paragraph and look framed and colored like this.
int = Integrate[1/(x^3 - 1), x];
Map[Framed, int, Infinity]
You can also embed notebook or attach notebook.
If there’s no simple rule for splitting the given association, then the simplest way might be to edit it by hand. At a glance, the order of entries seems the same in both codes. If so, you could just paste |>, <| at the appropriate junctures.
goldMedals = <|“USA” → 39, “China” → 38, “Japan” → 27|>;
listOfAssociations = Map[Association, Normal@goldMedals]
BarChart[listOfAssociations,ChartLayout->"Stacked",ChartLabels->Automatic]