replace basic if

def factorial(n):
    """ try match"""
    match n:
        case 0:
            return 1
        case x:
            return x * factorial(x-1)

def factorial2(n):
    """ try match"""
    match n:
        case 0:
            return 1
        case _ as x:
            return x * factorial2(x-1)

print(factorial(5))

print(factorial2(5))