Juliet C. answered 03/23/23
PhD in Computer Science with 8+ Years of Teaching Experience
Here is one possible approach, in pseudocode, with some steps at a high-level that would need to be broken down into sub-steps:
One Python technique that is useful for producing the result is to use the zip function inside a list comprehension to make tuples with one guess letter and one target letter for comparison to choose whether to have ‘G’ or ‘B’ in the result and then use the string function join to get back to a string from a list. For example: