Gradient Generator

Learning Objectives

By completing this challenge you will gain a good understanding of how RGB colour codes and hexadecimal colour codes work and you will apply this understanding to produce a complex algorithm.

Challenge #1

Complete the code below so that it draws 6 additional squares of different colours creating a linear gradient between both the given colours.

This is what the program should display on screen:
Allow the user to change the colours and make sure your program always create the desired gradient.

Challenge #2

The second challenge is similar to challenge #1, however this time the user will enter colour codes using the hexadecimal code. e.g. #FF0000 for red.
You will need to convert these codes back into RGB code before creating your gradient.

Share Button
Posted in Computer Science, Python - Advanced, Python Challenges Tagged with: , , ,

Our Latest Book