Answered step by step
Verified Expert Solution
Question
1 Approved Answer
github.co 7. Colour trio def colour_trio (colours) : This problem was inspired by the Mathologer video Secret of Row 10. To start, assume the
github.co 7. Colour trio def colour_trio (colours) : This problem was inspired by the Mathologer video "Secret of Row 10". To start, assume the exis- tence of three values called "red", "yellow" and "blue". These names serve as colourful (heh) mnemonics and could as well have been 0, 1, and 2, or "foo", "bar" and "baz"; no connection to actual physical colours is implied. Next, define a rule to mix such colours so that mixing any colour with itself gives that same colour, whereas mixing any two different colours always gives the third colour. For example, mixing blue to blue gives that same blue, whereas mixing blue to yellow gives red, same as mixing yellow to blue, or red to red. Given the first row of colours as a string of lowercase letters, this function should construct the rows below the first row one row at the time according to the following discipline. Each row is one element shorter than the previous row. The i:th element of each row comes from mixing the colours in positions i and i + 1 of the previous row. Rinse and repeat until only the singleton element of the bottom row remains, returned as the final answer. For example, starting from 'rybyr' leads to 'brrb', which leads to 'yry', which leads to 'bb', which leads to 'b' for the final answer, Regis. When the Python virtual machine laughs and goes 'brrrrr', that will lead to 'yrrrr', 'brrr', 'yrr', and 'br' for the final answer 'y' for "Yes, please!" colours 'y' 'bb' 'rybyry' 'brybbr' 'rbyryrrbyrbb' 'yrbbbbryyrybb' Expected result 'y' 'b' r' r' 'y' 'b' (Today's five-dollar power word to astonish your friends and coworkers is "quasigroup".)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started