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
88dfbe88
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
beginner
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
e252eacf
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
intermediate
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
87ee0584
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
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
advanced
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
33d66ed1
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
beginner
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
f01dac2d
def count_chars(text): return {c: text.count(c) for c in set(text)}
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
intermediate
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
66f2f5cf
# Lists & Dicts def flatten(nested): return [item for sublist in nested for item in sublist]
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
advanced
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
d19c696f
def merge_dicts(*dicts): return {k:v for d in dicts for k,v in d.items()}
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
beginner
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
3bc5fecc
# Error Handling def safe_int(value, default=0): try: return int(value) except: return default
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
intermediate
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
c2dad6ff
# Algorithms def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
advanced
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
8f1f8ce9
def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**0.5)+1))
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
beginner
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
377cd94e
# OOP class BaseModel: def __init__(self, **kwargs): self.__dict__.update(kwargs) def to_dict(self): return self.__dict__
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
intermediate
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
c41227e8
# Decorators def log_calls(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
advanced
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
654e246f
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
beginner
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
4d7024fc
# Regular Expressions def extract_emails(text): import re return re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', text)
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
intermediate
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
a6db8c9a
# JSON Operations def load_json(path): with open(path) as f: return json.load(f)
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
advanced
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
da2cbd5d
def save_json(path, data): with open(path, 'w') as f: json.dump(data, f)
Ghi nội dung vào file. Context manager tự động đóng file.
API integration là core trong modern applications.
python
beginner
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
f5a71c91
# File I/O def read_file(path): with open(path) as f: return f.read()
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
intermediate
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
75608d87
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
advanced
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
20346dc9
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
beginner
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
f4684ffa
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
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
intermediate
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
99cb65dc
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
advanced
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
206630c5
def count_chars(text): return {c: text.count(c) for c in set(text)}
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
beginner
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
cc51aa3d
# Lists & Dicts def flatten(nested): return [item for sublist in nested for item in sublist]
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
intermediate
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
57089815
def merge_dicts(*dicts): return {k:v for d in dicts for k,v in d.items()}
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
advanced
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
1c114fe5
# Error Handling def safe_int(value, default=0): try: return int(value) except: return default
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
beginner
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
5edddee8
# Algorithms def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
intermediate
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
65d6a0c8
def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**0.5)+1))
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
advanced
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
d94c5518
# OOP class BaseModel: def __init__(self, **kwargs): self.__dict__.update(kwargs) def to_dict(self): return self.__dict__
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
beginner
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
5fe0c674
# Decorators def log_calls(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
intermediate
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
ce098a8b
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
advanced
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
34f350c2
# Regular Expressions def extract_emails(text): import re return re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', text)
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
beginner
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
20dd39ef
# JSON Operations def load_json(path): with open(path) as f: return json.load(f)
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
intermediate
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
b5d74e36
def save_json(path, data): with open(path, 'w') as f: json.dump(data, f)
Xử lý danh sách: strip spaces, convert to lowercase, filter empty.
API integration là core trong modern applications.
python
advanced
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
cb91956a
# File I/O def read_file(path): with open(path) as f: return f.read()
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
beginner
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
e8167dd0
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
intermediate
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
3963049a
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
advanced
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
4df2dd46
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
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
beginner
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
ecae41ef
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
intermediate
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
9cdd3632
def count_chars(text): return {c: text.count(c) for c in set(text)}
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
advanced
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
bcee4a66
# Lists & Dicts def flatten(nested): return [item for sublist in nested for item in sublist]
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
beginner
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
98f002c6
def merge_dicts(*dicts): return {k:v for d in dicts for k,v in d.items()}
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
intermediate
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
9cb225b8
# Error Handling def safe_int(value, default=0): try: return int(value) except: return default
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
advanced
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
360c6805
# Algorithms def fibonacci(n): if n <= 1: return n return fibonacci(n-1) + fibonacci(n-2)
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
beginner
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
1453a0e0
def is_prime(n): return n > 1 and all(n % i for i in range(2, int(n**0.5)+1))
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
intermediate
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
c873c5e5
# OOP class BaseModel: def __init__(self, **kwargs): self.__dict__.update(kwargs) def to_dict(self): return self.__dict__
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
advanced
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
7c17b8a6
# Decorators def log_calls(func): def wrapper(*args, **kwargs): print(f"Calling {func.__name__}") return func(*args, **kwargs) return wrapper
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
beginner
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
9f367bbb
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
intermediate
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
977d3ae0
# Regular Expressions def extract_emails(text): import re return re.findall(r'[\w\.-]+@[\w\.-]+\.\w+', text)
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
advanced
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
94d46c71
# JSON Operations def load_json(path): with open(path) as f: return json.load(f)
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
beginner
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
2ddc68b3
def save_json(path, data): with open(path, 'w') as f: json.dump(data, f)
Nhóm items theo key. Tạo dictionary với key là group, value là list.
API integration là core trong modern applications.
python
intermediate
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
e505892b
# File I/O def read_file(path): with open(path) as f: return f.read()
Đảo ngược thứ tự các từ trong text.
API integration là core trong modern applications.
python
advanced
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
21e9901b
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Đảo ngược thứ tự các từ trong text.
API integration là core trong modern applications.
python
beginner
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
d7c688be
# Data Processing def process_data(items): return [x.strip().lower() for x in items if x]
Đảo ngược thứ tự các từ trong text.
API integration là core trong modern applications.
python
intermediate
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
3427bda5
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
Đảo ngược thứ tự các từ trong text.
API integration là core trong modern applications.
python
advanced
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
8c004983
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Đảo ngược thứ tự các từ trong text.
API integration là core trong modern applications.
python
beginner
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
05e3ffd2
def count_chars(text): return {c: text.count(c) for c in set(text)}
Đảo ngược thứ tự các từ trong text.
API integration là core trong modern applications.
python
intermediate
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
2283af0e
# Lists & Dicts def flatten(nested): return [item for sublist in nested for item in sublist]
Đảo ngược thứ tự các từ trong text.
API integration là core trong modern applications.
python
advanced
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
84fb941c
def merge_dicts(*dicts): return {k:v for d in dicts for k,v in d.items()}
Đảo ngược thứ tự các từ trong text.
API integration là core trong modern applications.
python
beginner
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
0fdd0a39
# 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.
API integration là core trong modern applications.
python
intermediate
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
0b60a3c5
# 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.
API integration là core trong modern applications.
python
advanced
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
7d014b3e
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.
API integration là core trong modern applications.
python
beginner
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
bfc09ac4
# 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.
API integration là core trong modern applications.
python
intermediate
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
df9ae56a
# 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.
API integration là core trong modern applications.
python
advanced
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
043f1ab1
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Đảo ngược thứ tự các từ trong text.
API integration là core trong modern applications.
python
beginner
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
15af2dba
# 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.
API integration là core trong modern applications.
python
intermediate
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
179cb8ce
# 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.
API integration là core trong modern applications.
python
advanced
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
9e4ed0eb
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.
API integration là core trong modern applications.
python
beginner
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
dcebbb13
# 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ự.
API integration là core trong modern applications.
python
intermediate
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
c637c2fb
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ự.
API integration là core trong modern applications.
python
advanced
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
7adaf214
# 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ự.
API integration là core trong modern applications.
python
beginner
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
f4a17dba
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ự.
API integration là core trong modern applications.
python
intermediate
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
9e60527e
# 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ự.
API integration là core trong modern applications.
python
advanced
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
b1b00d8a
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ự.
API integration là core trong modern applications.
python
beginner
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
96050441
# 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ự.
API integration là core trong modern applications.
python
intermediate
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
ca929640
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ự.
API integration là core trong modern applications.
python
advanced
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
a2a7fdcb
# 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ự.
API integration là core trong modern applications.
python
beginner
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
411b65e6
# 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ự.
API integration là core trong modern applications.
python
intermediate
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
2ff0d3d4
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ự.
API integration là core trong modern applications.
python
advanced
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
61582af2
# 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ự.
API integration là core trong modern applications.
python
beginner
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
caeb160a
# 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ự.
API integration là core trong modern applications.
python
intermediate
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
ede85ee5
# 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ự.
API integration là core trong modern applications.
python
advanced
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
e301f79d
# 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ự.
API integration là core trong modern applications.
python
beginner
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
cb08bcdf
# 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ự.
API integration là core trong modern applications.
python
intermediate
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]
e9144a0f
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ự.
API integration là core trong modern applications.
python
advanced
[ "io", "file-operations" ]
3.9+
[ "python", "function", "example" ]
b671a24f
# 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.
API integration là core trong modern applications.
python
beginner
[ "file-io", "context-manager" ]
3.9+
[ "python", "function", "example" ]
a0c9585d
def write_file(path, content): with open(path, 'w') as f: f.write(content)
Làm phẳng list nested thành flat list.
API integration là core trong modern applications.
python
intermediate
[ "list-processing", "data-structures" ]
3.9+
[ "python", "function", "example" ]
bcb90bd8
# 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.
API integration là core trong modern applications.
python
advanced
[ "string", "text-processing" ]
3.9+
[ "python", "function", "example" ]
7efeb53b
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.
API integration là core trong modern applications.
python
beginner
[ "grouping", "dict" ]
3.9+
[ "python", "function", "example" ]
520991f3
# String Operations def reverse_words(text): return ' '.join(text.split()[::-1])
Làm phẳng list nested thành flat list.
API integration là core trong modern applications.
python
intermediate
[ "string", "manipulation" ]
3.9+
[ "python", "function", "example" ]
59b83441
def count_chars(text): return {c: text.count(c) for c in set(text)}
Làm phẳng list nested thành flat list.
API integration là core trong modern applications.
python
advanced
[ "dict", "counting" ]
3.9+
[ "python", "function", "example" ]
39931f5d
# 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.
API integration là core trong modern applications.
python
beginner
[ "list", "flattening" ]
3.9+
[ "python", "function", "example" ]
ad9726a4
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.
API integration là core trong modern applications.
python
intermediate
[ "dict", "merging" ]
3.9+
[ "python", "function", "example" ]
485458ed
# 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.
API integration là core trong modern applications.
python
advanced
[ "error-handling", "type-conversion" ]
3.9+
[ "python", "function", "example" ]
0f5efb65
# 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.
API integration là core trong modern applications.
python
beginner
[ "recursion", "algorithm" ]
3.9+
[ "python", "function", "example" ]
6be52464
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.
API integration là core trong modern applications.
python
intermediate
[ "algorithm", "math" ]
3.9+
[ "python", "function", "example" ]
6aa268b2
# 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.
API integration là core trong modern applications.
python
advanced
[ "class", "oop" ]
3.9+
[ "python", "function", "example" ]
a84cf708
# 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.
API integration là core trong modern applications.
python
beginner
[ "decorator", "function" ]
3.9+
[ "python", "function", "example" ]
63b13afe
# Working with APIs def fetch_data(url): import requests return requests.get(url).json()
Làm phẳng list nested thành flat list.
API integration là core trong modern applications.
python
intermediate
[ "api", "http" ]
3.9+
[ "python", "function", "example" ]
0c913944
# 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.
API integration là core trong modern applications.
python
advanced
[ "regex", "pattern-matching" ]
3.9+
[ "python", "function", "example" ]
28424493
# 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.
API integration là core trong modern applications.
python
beginner
[ "json", "file-io" ]
3.9+
[ "python", "function", "example" ]