Convert a color rule into an algorithm
Table 1 defines the result of combining two different colors. Each input is Red, Yellow, or Blue. Input order does not change the result.
| First color | Second color | Result |
|---|---|---|
| Red | Yellow | Orange |
| Yellow | Blue | Green |
| Blue | Red | Purple |
The algorithm receives color_1 and color_2. Capitalization has already been normalized. A pair is valid when it contains two different listed colors and matches one table row in either order. For a repeated color or any other word, output Invalid combination.
Write pseudocode for the rule. Then give the outputs for (Yellow, Red), (Blue, Yellow), (Red, Red), and (Green, Blue).
TipHint
Each table row represents two possible input orders.