2

Apply Style to the letters A, B , C and D according to the specifications listed below. The number represents the font size and the color represents the font color. (Hint: Use Apply.)

Input:

{{"A",25,Red},{"B",30,Green},{"C",35,Blue},{"D",40,Brown}}

Expected Output:

enter image description here

After going through the Apply section (https://reference.wolfram.com/language/ref/Apply.html), I fail to figure out how Apply can be applied for this problem.

More explanation that would help solve the problem appreciated.

1 Answers1

3

I do not understand what you want. You say you want to change the style of the letters, then you show the expected output as something else. But if you mean you want to change the type of the letters, you can use Style

lis={{"A",25,Red},{"B",30,Green},{"C",35,Blue},{"D",40,Brown}}
Style[#[[1]],#[[2]],#[[3]]]&/@lis

Mathematica graphics

You can also use short cut

Style @@@ lis

Mathematica graphics

If this is not what you want, may be you can clarify.

Nasser
  • 143,286
  • 11
  • 154
  • 359
  • The solution has worked. Might be there is also a way by Apply. – Splendid Digital Solutions Sep 12 '21 at 07:47
  • 1
    @SplendidDigitalSolutions when you do Style["A",25,Red] Mathematica is smart and knows that 25 is for font size and Red is for color and it applies them to the first argument which is "A" . If you want to make {"A",25} be red, you can do Style[{"A", 25}, Red] – Nasser Sep 12 '21 at 07:48
  • 1
    @SplendidDigitalSolutions you ask: Might be there is also a way by Apply. I am not sure what you mean. f @@@ expr is the same as Apply[f,expr,{1}] so the above answer is using Apply. – Nasser Sep 12 '21 at 08:08
  • I was not aware f @@@ expr is the same as Apply[f,expr,{1}]. – Splendid Digital Solutions Sep 12 '21 at 08:13
  • 4
    @SplendidDigitalSolutions You have asked several questions that are quizzes or exercises from Wolfram-U courses. This is not the forum for asking those questions. They should be asked on the Wolfram Community site post corresponding to the course. The point of a quiz or exercise is for you to solve it, not ask someone else to solve it for you. – Rohit Namjoshi Sep 12 '21 at 18:42
  • @RohitNamjoshi I am sorry. Actually, I was trying to solve by myself while seeking help. Going forward, I will avoid this action. – Splendid Digital Solutions Sep 13 '21 at 00:00