A baby loves candy!!
She has lots of candy to eat. There are some "red" ones, some "green" ones and some "blue" ones.
Her favourite ones are the "red" ones.
She knows how to count and if there are less than 5 "red" candies on the table, she will start to cry!
Develop a computer program to simulate this scenario.
A computer game designer has created an algorithm to solve the puzzle. Here it is:
Create a modular solution to this problem. Challenge yourself to design 4+ functions to perform specific tasks in the solution.
Determine which data can be local to a function, and which data needs to be global because it is required by multiple functions.
Just because your code runs and does not have any syntax errors, that does not mean it works correctly.
You should carefully choose test data and check that your code works perfectly with different sets of data.
Do you have any ideas for making this program more fun, interesting, surprising?
Make sure you are thoughtful when testing your solution.
If your code has a validation check, test your code with acceptable/valid data and unacceptable/invalid data.