Веселина обнови решението на 23.10.2022 13:05 (преди около 2 години)
+def calculate_final_vector(coordinates, code_color_list):
+ x = coordinates[0]
+ y = coordinates[1]
+ for code in code_color_list:
+ code = code.upper()
+ if code == '000000':
+ break
+ elif code == 'FFFFFF':
+ continue
+ elif code == 'C0FFC0' or code == 'C00000':
+ x -= 1
+ elif code == '00C000' or code == 'FFC0C0':
+ x += 1
+ elif code == 'FFFFC0' or code == '0000C0':
+ y -= 1
+ elif code == 'C0C000' or code == 'C0C0FF':
+ y += 1
+ return x, y
Можеш да използваш unpacking:
x, y = coordinates