O6: telemetry report and eval task set (#14)
This commit was merged in pull request #14.
This commit is contained in:
1 parent
bea07e82bb
commit
b2d72f2dc9
31 files changed
+809
-3
No files matched your search
@@ -0,0 +1,8 @@
|
||||
from text import slugify, shout
|
||||
|
||||
assert slugify('Hello, World!') == 'hello-world'
|
||||
assert slugify(' a b ') == 'a-b'
|
||||
assert slugify('---') == ''
|
||||
assert slugify('x1_y2') == 'x1-y2'
|
||||
assert shout('a') == 'A!'
|
||||
print('ok')
|
||||
@@ -0,0 +1,2 @@
|
||||
def shout(s):
|
||||
return s.upper() + '!'
|
||||
@@ -0,0 +1 @@
|
||||
python3 test_text.py
|
||||
@@ -0,0 +1,9 @@
|
||||
import re
|
||||
|
||||
|
||||
def shout(s):
|
||||
return s.upper() + '!'
|
||||
|
||||
|
||||
def slugify(s):
|
||||
return re.sub(r'[^a-z0-9]+', '-', s.lower()).strip('-')
|
||||
@@ -0,0 +1,3 @@
|
||||
# Add slugify
|
||||
|
||||
Add a function `slugify(s)` to `text.py`: lowercase, every run of non-alphanumeric characters becomes a single `-`, no leading or trailing `-`. Example: `slugify('Hello, World!')` is `'hello-world'`.
|
||||
Reference in new issue
Block a user