Вяткина Анна, 619/2 группа CopyPaste 2669 | Иван Сеченых, 521 (асвк+мк+мс) CopyPaste 1669 | ||||
---|---|---|---|---|---|
f | 1 | import ast | f | 1 | import ast |
2 | 2 | ||||
t | 3 | def copypaste(f1, f2): | t | 3 | def copypaste(one, two): |
4 | ast1 = ast.parse(f1) | 4 | treeA = ast.parse(one) | ||
5 | ast2 = ast.parse(f2) | 5 | treeB = ast.parse(two) | ||
6 | for node1, node2 in zip(ast.walk(ast1), ast.walk(ast2)): | 6 | for A, B in zip(ast.walk(treeA), ast.walk(treeB)): | ||
7 | if type(node1) != type(node2): | 7 | if type(A) != type(B): | ||
8 | return False | 8 | break | ||
9 | else: | ||||
9 | return True | 10 | return True | ||
11 | return False |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|