From 006c253ad87d851e297bf1250c8166980b745ca6 Mon Sep 17 00:00:00 2001 From: Marege Date: Tue, 17 Nov 2026 14:27:18 +0100 Subject: [PATCH] U10fix3 --- u10/najkratsia_cesta.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/u10/najkratsia_cesta.py b/u10/najkratsia_cesta.py index dcdfc6f..f9ef96d 100644 --- a/u10/najkratsia_cesta.py +++ b/u10/najkratsia_cesta.py @@ -12,4 +12,18 @@ def shortest_path(number_of_nodes, connections): dist[start] = 0 path[start] = [start] + change = True + while change: + change = False + for i in connections: + first = i[0] + to = i[1] + length = i[2] + for i,j in [(first, to), (to, first)]: + + if dist[i] is None: + continue + if j in path[i]: + continue + return path[end]