Recent Snippets


Created February 6, 2025
squares = [x**2 for x in range(10)]
print(f"Squares: {squares}")

even_numbers = [x for x in range(20) if x % 2 == 0]
print(f"Even Numbers: {even_numbers}")
Concise and powerful way to create lists
Created February 6, 2025
function fibonacci(n) {
    if (n <= 0) return 0;
    if (n === 1) return 1;
    return fibonacci(n - 1) + fibonacci(n - 2);
}

console.log(fibonacci(10)); // Output: 55
Calculates the nth Fibonacci number
Created February 5, 2025
This is my first post on snippetz.dev!
First Post