id
stringlengths
8
8
code
stringclasses
17 values
explanation
stringclasses
17 values
context
stringclasses
17 values
language
stringclasses
1 value
difficulty
stringclasses
3 values
tags
listlengths
2
2
version
stringclasses
1 value
keywords
listlengths
3
3
e7e1e09a
# Error Handling def safe_int(value, default=0): try: return int(value) except: return default
Đảo ngược thứ tự các từ trong text.
File operations là fundamentals trong programming.
python
advanced
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
39de69e9
# Algorithms def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)
Đảo ngược thứ tự các từ trong text.
File operations là fundamentals trong programming.
python
beginner
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
63d290f0
def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**0.5)+1))
Đảo ngược thứ tự các từ trong text.
File operations là fundamentals trong programming.
python
intermediate
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
dcaad466
# OOP class BaseModel: def __init__(self, **kwargs): self.__dict__.update(kwargs) def to_dict(self): return self.__dict__
Đảo ngược thứ tự các từ trong text.
File operations là fundamentals trong programming.
python
advanced
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
4a371704
# Decorators def log_calls(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper
Đảo ngược thứ tự các từ trong text.
File operations là fundamentals trong programming.
python
beginner
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
d0060cfb
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Đảo ngược thứ tự các từ trong text.
File operations là fundamentals trong programming.
python
intermediate
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
ac3eca8c
# Regular Expressions def extract_emails(text): import re return re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', text)
Đảo ngược thứ tự các từ trong text.
File operations là fundamentals trong programming.
python
advanced
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
180b9919
# JSON Operations def load_json(path): with open(path) as f: return json.load(f)
Đảo ngược thứ tự các từ trong text.
File operations là fundamentals trong programming.
python
beginner
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
e3934422
def save_json(path, data): with open(path, 'w') as f: json.dump(data, f)
Đảo ngược thứ tự các từ trong text.
File operations là fundamentals trong programming.
python
intermediate
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
72cbb5fa
# File I/O def read_file(path): with open(path) as f: return f.read()
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
advanced
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
6d29b1cc
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
beginner
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
db2c6042
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
intermediate
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
234b770c
def group_by_key(items, key): result = {} for item in items: k = item.get(key) if k not in result: result[k] = [] result[k].append(item) return result
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
advanced
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
64356fe3
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
beginner
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
e50486de
def count_chars(text): return {c: text.count(c) for c in set(text)}
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
intermediate
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
b0d0795e
# Lists & Dicts def flatten(nested): return [item for sublist in nested for item in sublist]
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
advanced
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
da6484d6
def merge_dicts(*dicts): return {k:v for d in dicts for k,v in d.items()}
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
beginner
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
9c0ea634
# Error Handling def safe_int(value, default=0): try: return int(value) except: return default
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
intermediate
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
8eb1b9cb
# Algorithms def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
advanced
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
d973a2c8
def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**0.5)+1))
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
beginner
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
4e99a32d
# OOP class BaseModel: def __init__(self, **kwargs): self.__dict__.update(kwargs) def to_dict(self): return self.__dict__
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
intermediate
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
10e59787
# Decorators def log_calls(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
advanced
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
36207a53
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
beginner
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
02ab28d5
# Regular Expressions def extract_emails(text): import re return re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', text)
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
intermediate
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
51a40225
# JSON Operations def load_json(path): with open(path) as f: return json.load(f)
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
advanced
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
46a37dfe
def save_json(path, data): with open(path, 'w') as f: json.dump(data, f)
Đếm tần suất xuất hiện của mỗi ký tự.
File operations là fundamentals trong programming.
python
beginner
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
b63cb5d8
# File I/O def read_file(path): with open(path) as f: return f.read()
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
intermediate
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
0c8dfbea
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
advanced
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
69b5dbb0
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
beginner
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
734eeb1f
def group_by_key(items, key): result = {} for item in items: k = item.get(key) if k not in result: result[k] = [] result[k].append(item) return result
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
intermediate
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
f2823e29
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
advanced
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
f0e33892
def count_chars(text): return {c: text.count(c) for c in set(text)}
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
beginner
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
d4497d63
# Lists & Dicts def flatten(nested): return [item for sublist in nested for item in sublist]
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
intermediate
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
80986641
def merge_dicts(*dicts): return {k:v for d in dicts for k,v in d.items()}
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
advanced
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
7aed34bc
# Error Handling def safe_int(value, default=0): try: return int(value) except: return default
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
beginner
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
077831f6
# Algorithms def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
intermediate
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
f039291f
def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**0.5)+1))
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
advanced
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
c05113e3
# OOP class BaseModel: def __init__(self, **kwargs): self.__dict__.update(kwargs) def to_dict(self): return self.__dict__
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
beginner
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
70ba5cc4
# Decorators def log_calls(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
intermediate
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
dad37944
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
advanced
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
ed7bab67
# Regular Expressions def extract_emails(text): import re return re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', text)
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
beginner
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
ff1b40be
# JSON Operations def load_json(path): with open(path) as f: return json.load(f)
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
intermediate
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
017abedf
def save_json(path, data): with open(path, 'w') as f: json.dump(data, f)
Làm phẳng list nested thành flat list.
File operations là fundamentals trong programming.
python
advanced
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
d7a9ec8e
# File I/O def read_file(path): with open(path) as f: return f.read()
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
beginner
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
c51af5c6
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
intermediate
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
bdbfda70
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
advanced
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
3f92a80f
def group_by_key(items, key): result = {} for item in items: k = item.get(key) if k not in result: result[k] = [] result[k].append(item) return result
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
beginner
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
6bdecf35
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
intermediate
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
45be4960
def count_chars(text): return {c: text.count(c) for c in set(text)}
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
advanced
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
27109888
# Lists & Dicts def flatten(nested): return [item for sublist in nested for item in sublist]
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
beginner
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
bcced77d
def merge_dicts(*dicts): return {k:v for d in dicts for k,v in d.items()}
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
intermediate
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
48a3457e
# Error Handling def safe_int(value, default=0): try: return int(value) except: return default
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
advanced
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
1f7146ec
# Algorithms def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
beginner
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
cb4a1cec
def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**0.5)+1))
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
intermediate
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
b7432b3f
# OOP class BaseModel: def __init__(self, **kwargs): self.__dict__.update(kwargs) def to_dict(self): return self.__dict__
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
advanced
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
e8a1ddba
# Decorators def log_calls(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
beginner
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
3b153fd4
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
intermediate
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
0385c9bf
# Regular Expressions def extract_emails(text): import re return re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', text)
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
advanced
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
16da6d8e
# JSON Operations def load_json(path): with open(path) as f: return json.load(f)
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
beginner
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
0d796b0c
def save_json(path, data): with open(path, 'w') as f: json.dump(data, f)
Gộp nhiều dictionaries thành một.
File operations là fundamentals trong programming.
python
intermediate
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
6749ea8c
# File I/O def read_file(path): with open(path) as f: return f.read()
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
advanced
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
042604b3
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
beginner
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
85f988fd
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
intermediate
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
31e71aeb
def group_by_key(items, key): result = {} for item in items: k = item.get(key) if k not in result: result[k] = [] result[k].append(item) return result
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
advanced
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
ee4490b0
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
beginner
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
9bcd63c1
def count_chars(text): return {c: text.count(c) for c in set(text)}
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
intermediate
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
c20918f9
# Lists & Dicts def flatten(nested): return [item for sublist in nested for item in sublist]
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
advanced
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
90fd6155
def merge_dicts(*dicts): return {k:v for d in dicts for k,v in d.items()}
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
beginner
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
48eb472f
# Error Handling def safe_int(value, default=0): try: return int(value) except: return default
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
intermediate
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
82d50fce
# Algorithms def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
advanced
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
7d45b865
def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**0.5)+1))
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
beginner
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
7d27cd97
# OOP class BaseModel: def __init__(self, **kwargs): self.__dict__.update(kwargs) def to_dict(self): return self.__dict__
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
intermediate
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
0a329926
# Decorators def log_calls(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
advanced
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
5173d5d2
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
beginner
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
5b652697
# Regular Expressions def extract_emails(text): import re return re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', text)
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
intermediate
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
57bf9d0b
# JSON Operations def load_json(path): with open(path) as f: return json.load(f)
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
advanced
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
9f8ea842
def save_json(path, data): with open(path, 'w') as f: json.dump(data, f)
Chuyển đổi string thành int, trả về default nếu lỗi.
File operations là fundamentals trong programming.
python
beginner
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
e59ae8be
# File I/O def read_file(path): with open(path) as f: return f.read()
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
intermediate
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
f6a0cbc2
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
advanced
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
9c47e18c
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
beginner
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
7b52b66e
def group_by_key(items, key): result = {} for item in items: k = item.get(key) if k not in result: result[k] = [] result[k].append(item) return result
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
intermediate
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
db1a37e5
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
advanced
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
c521ab25
def count_chars(text): return {c: text.count(c) for c in set(text)}
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
beginner
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
7362c5d2
# Lists & Dicts def flatten(nested): return [item for sublist in nested for item in sublist]
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
intermediate
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
6dd5a315
def merge_dicts(*dicts): return {k:v for d in dicts for k,v in d.items()}
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
advanced
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
8a36db15
# Error Handling def safe_int(value, default=0): try: return int(value) except: return default
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
beginner
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
1264b495
# Algorithms def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
intermediate
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
40468317
def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**0.5)+1))
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
advanced
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
f97c8a47
# OOP class BaseModel: def __init__(self, **kwargs): self.__dict__.update(kwargs) def to_dict(self): return self.__dict__
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
beginner
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
c45fbaa3
# Decorators def log_calls(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
intermediate
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
0a0a0f5e
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
advanced
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
69a3e83d
# Regular Expressions def extract_emails(text): import re return re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', text)
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
beginner
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
56089b33
# JSON Operations def load_json(path): with open(path) as f: return json.load(f)
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
intermediate
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
add109e1
def save_json(path, data): with open(path, 'w') as f: json.dump(data, f)
Fibonacci recursive. Chậm nhưng minh họa recursion.
File operations là fundamentals trong programming.
python
advanced
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
a6c138a1
# File I/O def read_file(path): with open(path) as f: return f.read()
Kiểm tra số nguyên tố. Dùng all() để check tất cả divisors.
File operations là fundamentals trong programming.
python
beginner
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
ee94546b
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Kiểm tra số nguyên tố. Dùng all() để check tất cả divisors.
File operations là fundamentals trong programming.
python
intermediate
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
f2f209fd
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Kiểm tra số nguyên tố. Dùng all() để check tất cả divisors.
File operations là fundamentals trong programming.
python
advanced
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
feba479d
def group_by_key(items, key): result = {} for item in items: k = item.get(key) if k not in result: result[k] = [] result[k].append(item) return result
Kiểm tra số nguyên tố. Dùng all() để check tất cả divisors.
File operations là fundamentals trong programming.
python
beginner
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
b6c9189b
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Kiểm tra số nguyên tố. Dùng all() để check tất cả divisors.
File operations là fundamentals trong programming.
python
intermediate
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
d155a890
def count_chars(text): return {c: text.count(c) for c in set(text)}
Kiểm tra số nguyên tố. Dùng all() để check tất cả divisors.
File operations là fundamentals trong programming.
python
advanced
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]