Skip to content

Commit 16af7c1

Browse files
Conflict resolving
2 parents 60df483 + 8200493 commit 16af7c1

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

hw_2/maria_iter.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1+
from examples_2.utils import print_stars
2+
13
def unique(lst):
24
seen = set()
35
return [el for el in lst if el not in seen and not seen.add(el)]
46

57
lst = [1, 2, 1, 3, 4, 3, 3, 3]
68
print("Initial list: {}".format(lst))
7-
print("List with unique elements: {}".format(unique(lst)))
9+
print("List with unique elements: {}".format(unique(lst)))
10+
11+
12+
def divide(a, b):
13+
try:
14+
result = a/b
15+
except Exception:
16+
return (False, None)
17+
else:
18+
return (True, result)
19+
20+
def print_division_result(a, b):
21+
print_stars()
22+
print("Trying to divide '{}' by '{}'".format(a, b))
23+
print("Result: '{}'".format(divide(a,b)))
24+
25+
print_division_result(1, 0)
26+
print_division_result([], 4)
27+
print_division_result(4, 2)

0 commit comments

Comments
 (0)