This commit is contained in:
Patrik Tulach 2026-10-13 14:43:00 +02:00
parent 16e3eb2d8c
commit 567f057013

View File

@ -4,9 +4,12 @@ def is_paired(input_string):
search = [] search = []
for chr in input_string: for i, chr in enumerate(input_string):
if chr in open: if chr in open:
search.append(close[open.index(chr)]) search.append(close[open.index(chr)])
if i == len(input_string) -1:
return False
continue continue
if chr in (open + close): if chr in (open + close):
@ -18,8 +21,4 @@ def is_paired(input_string):
else: else:
return False return False
return True return True
print(is_paired("() a[]b()c{[} [fds]gh"))