I have been using the free online resource Elementary Introduction to the Wolfram Language for a number of years to introduce beginning biologists to the Wolfram Language. The text is a great resource, yet every year we get to Question 7.9 in Chapter 7, and my students (and me) get frustrated that the expected output does not match the output created by the answer keys own proposed solution.
See this screenshot:
The only workaround I know of - and which I share with students - is to use a Graphics statement.
Is the problem with this question that the expected output is wrong OR should Style[Purple,100] produce the correct output but doesn’t?
On my desktop both
Style[Purple, 100]
Graphics[{Purple, Rectangle[]}, ImageSize -> 100]
work fine, although the latter comes out a bit larger.
Thank you for checking this code on your desktop, Gianluca.
I can verify your observations that the code works on the desktop (V14.2 Windows 10), which leads to the important realization that the code does not seem to work correctly on the cloud. I am accessing the Wolfram Cloud through a Google Chrome web browser on Windows Desktops with my students.
Can anyone else verify that the code in question does not work on the cloud?
I can verify. On desktop 14.2 the size of the Style[Purple,100] square is as expected in the course. But very small in Wolfram Cloud on Firefox. I am using Windows 11.
Thank you, Hans, for checking! Your results confirm that there is something wrong in the Wolfram Cloud. I will submit a formal bug report to Wolfram.
Thank you! I am confronting the same issue, using the online course environment.
Style[Purple,100] delivers a small (standard) purple swatch in a larger carriage-return area of empty space (I do not have the vocab to describe this area, but it looks like the empty space is sized for 100 point font).