FIND YOUR NEXT FEW LINES

Results for “library”

Small, practical examples. Search by task or narrow things down below.

653 snippets foundClear filters
PythonIteration & sequences

Flatten one level of nested lists

Python: Use a nested comprehension when each input item is itself an iterable.

Python✓ Tested
JavaNumbers & dates

Format a decimal number

Format a Java decimal with two digits and a fixed locale.

Java✓ Tested
CNumbers & memory

Format a decimal value

Print two fractional digits with C printf.

C✓ Tested
GoGetting Started

Format a readable status message

Format a readable status message using a complete Go program with explicit sample inputs.

Go✓ Tested
GoDates & times

Format a UTC timestamp

Format a UTC timestamp using a complete Go program with explicit sample inputs.

Go✓ Tested
RustParsing & byte data

Format an integer as padded hexadecimal

Format an integer as padded hexadecimal in a complete Rust program using the standard library.

Rust✓ Tested
C++Numbers & algorithms

Format decimal output

Use fixed and setprecision to print two C++ decimal places.

C++✓ Tested
JavaDates & time zones

Generate a half-open range of dates

Java: datesUntil includes the starting date and excludes the end date.

Java✓ Tested
PythonIteration & sequences

Generate combinations across two collections

Python: Use product for a Cartesian product; this differs from selecting combinations within one collection.

Python✓ Tested
GoGetting Started

Group fields in a struct

Group fields in a struct using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonMappings & sets

Group records by a field

Python: Accumulate related values with defaultdict without checking whether each group exists.

Python✓ Tested
JavaStream transformations

Group strings by their length

Java: Choose a TreeMap supplier when group keys must have deterministic order.

Java✓ Tested