We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6828cfb commit 1bdeee8Copy full SHA for 1bdeee8
hw_2/olga_iter.py
@@ -1,3 +1,5 @@
1
+import re
2
+
3
def unique(l):
4
return list(set(l))
5
@@ -15,3 +17,18 @@ def divide(a, b):
15
17
print(divide(4, False))
16
18
print(divide(4, None))
19
print(divide(4, 2))
20
21
22
+def wc(s):
23
+ return {"symbols": len(re.findall(r'\w', s)),
24
+ "words": len(re.findall(r'\w\w*', s)),
25
+ "lines": s.count("\n") + 1}
26
27
+s = """d ss
28
+ ddd
29
+123_45f
30
+dd
31
+d"""
32
33
+print(wc(s))
34
+print(re.findall(r'\w', s))
0 commit comments