Решение на Навигация на Piet от Валерия Стояновска

Обратно към всички решения

Към профила на Валерия Стояновска

Резултати

  • 0 точки от тестове
  • 0 бонус точки
  • 0 точки общо
  • 0 успешни тест(а)
  • 0 неуспешни тест(а)

Код

def calculate_final_result(coordinates, *args):
x, y = coordinates
for i in range(0, len(args), 1):
for color in args:
if color[i] == '000000' : # black
break
elif color[i] == 'C0FFC0' or color[i] == 'FFC0C0' or color[i] == 'c0ffc0' or color[i] == 'ffc0c0': # light green or light red
x -= 1
elif color[i] == '00C000' or color[i] == 'C00000' or color[i] == '00c000' or color[i] == 'c00000': # dark green or dark red
x += 1
elif color[i] == 'C0C000' or color[i] == '0000C0' or color[i] == 'c0c000' or color[i] == '0000c0': # dark yellow or dark blue
y += 1
elif color[i] == 'FFFFC0' or color[i] == 'C0C0FF' or color[i] == 'ffffc0' or color[i] == 'c0c0ff': # light yellow or light blue
y -= 1
elif color[i] == 'FFFFFF' or color[i] == 'ffffff': # white
continue
return x, y

Лог от изпълнението

cannot import name 'calculate_final_vector' from 'solution' (/tmp/d20221025-351493-1b7z0tm/solution.py)
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221020151654/lib/language/python/runner.py", line 114, in main
    loaded_test = importlib.import_module('test', test_module)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/tmp/d20221025-351493-1b7z0tm/test.py", line 3, in <module>
    from solution import calculate_final_vector

История (1 версия и 0 коментара)

Валерия обнови решението на 25.10.2022 17:09 (преди около 2 години)

+def calculate_final_result(coordinates, *args):
+ x, y = coordinates
+
+ for i in range(0, len(args), 1):
+ for color in args:
+
+ if color[i] == '000000' : # black
+ break
+
+ elif color[i] == 'C0FFC0' or color[i] == 'FFC0C0' or color[i] == 'c0ffc0' or color[i] == 'ffc0c0': # light green or light red
+ x -= 1
+
+ elif color[i] == '00C000' or color[i] == 'C00000' or color[i] == '00c000' or color[i] == 'c00000': # dark green or dark red
+ x += 1
+
+ elif color[i] == 'C0C000' or color[i] == '0000C0' or color[i] == 'c0c000' or color[i] == '0000c0': # dark yellow or dark blue
+ y += 1
+
+ elif color[i] == 'FFFFC0' or color[i] == 'C0C0FF' or color[i] == 'ffffc0' or color[i] == 'c0c0ff': # light yellow or light blue
+ y -= 1
+
+ elif color[i] == 'FFFFFF' or color[i] == 'ffffff': # white
+ continue
+
+ return x, y