Александра обнови решението на 25.10.2022 17:43 (преди около 2 години)
+"""Homework 01 module for fmi-intro-to-python-2022"""
+
+def calculate_final_vector(starting_point, steps_list):
+ """Navigation system based on Piet Mondrian's art."""
+ steps_dict = {
+ 'C0FFC0': (-1, 0),
+ 'FFC0C0': (1, 0),
+ 'C0C0FF': (0, 1),
+ 'FFFFC0': (0, -1),
+ 'C00000': (-1, 0),
+ '00C000': (1, 0),
+ 'C0C000': (0, 1),
+ '0000C0': (0, -1),
+ 'FFFFFF': (0, 0)
+ }
+ if '000000' in steps_list:
+ del steps_list[steps_list.index('000000'):]
+ for step in steps_list:
+ move = steps_dict.get(step.upper())
+ starting_point = tuple(sum(x) for x in zip(starting_point, move))
+ return starting_point