Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Henrik Christensen
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

Updated Random Quote Machine


I just finished updating my old Random Quote Machine and thinking if there is something that should be changed or if it's all good?

I'm aware that some of the quotes > 140 characters which is what I'm trying to fix at the moment.


1 Answer

Steven Parker
Steven Parker
225,652 Points

:point_right: You can make the code a bit more compact if you want.

You could replace the entire long switch statement in randomColorThemes with this single line:

    changeColorTheme(colorThemes[randomColor - 1]);

And you could simplify it a bit further by removing the "+ 1" from the computation of randomColor, and then remove the "- 1" from this line.