Марио обнови решението на 21.10.2022 15:09 (преди около 2 години)
+def calculate_final_vector(coordinates, colors):
+ colorPallete = {
+ "C0FFC0": "Light Green",
+ "FFFFC0": "Light Yellow",
+ "FFC0C0": "Light Red",
+ "C0C0FF": "Light Blue",
+ "00C000": "Dark Green",
+ "C0C000": "Dark Yellow",
+ "C00000": "Dark Red",
+ "0000C0": "Dark Blue",
+ "FFFFFF": "White",
+ "000000": "Black"
+ }
+
+ first, second = coordinates
+ formattedColors = map(lambda x: x.upper(), colors)
+
+ for color in formattedColors:
+ if colorPallete[color] == "Light Green":
+ first = first-1
+ elif colorPallete[color] == "Light Yellow":
+ second = second-1
+ elif colorPallete[color] == "Light Red":
+ first = first+1
+ elif colorPallete[color] == "Light Blue":
+ second = second+1
+ elif colorPallete[color] == "Dark Green":
+ first = first+1
+ elif colorPallete[color] == "Dark Yellow":
+ second = second+1
+ elif colorPallete[color] == "Dark Red":
+ first = first-1
+ elif colorPallete[color] == "Dark Blue":
+ second = second-1
+ elif colorPallete[color] == "White":
+ continue
+ elif colorPallete[color] == "Black":
+ break
+
+ return (first, second)