Георги обнови решението на 20.10.2022 11:47 (преди около 2 години)
+def calculate_final_vector(starting_point, colours):
+ colours_dict = {
+ '00C000' : [1,0],
+ 'C0FFC0' : [-1,0],
+ 'C00000' : [-1,0],
+ 'FFFFFF' : [0,0],
+ 'C0C000' : [0,1]
+ }
+ if len(starting_point) != 2:
+ return 'starting point length must be 2'
+ dist_point = list(starting_point)
+ for colour in colours:
+ if colour.upper() not in colours_dict:
+ return 'colour is not found'
+ for colour in colours:
+ dist_point[0] += colours_dict[colour.upper()][0]
+ dist_point[1] += colours_dict[colour.upper()][1]
+ return tuple(dist_point[:])