C
de
S
pace
Explore
Log In
Explore
Sign Up
Log In
drewnovak469
22.05.2026 11:41
1
Trie implementation #37
Ideas welcome
utils.py
from collections import Counter def top_words(text, n=5): words = text.lower().split() return Counter(words).most_common(n) print(top_words('the cat sat on the mat the cat'))
test.py
def is_prime(n): if n < 2: return False for i in range(2, int(n**0.5)+1): if n % i == 0: return False return True print(is_prime(17))
Idle
Try It
Clear
Log in
to leave a comment
Are you sure you want to delete this post?
Delete
Cancel