In some tech interviews, I've been asked to code up simple functions in order to demonstrate my programming prowess. Usually, my code ends up being a few lines long to accommodate input validation and readability, but today, I felt like golfing.

Below, I've condensed some of these functions into one-liners. Turns out, many of these are still readable!

def factorial(n):
    return n if n <= 1 else n * factorial(n-1)
def fibonacci(n):
    return n if n <= 1 else fibonacci(n-1) + fibonacci(n-2)
def fizzbuzz(n):
    return ("fizz" * (n % 3 == 0)) + ("buzz" * (n % 5 == 0)) or str(n)
def is_leap_year(year):
    return (year % 400 == 0) or (year % 4 == 0 and year % 100 != 0)
def is_palindrome(word):
    return word[::-1] == word