human
I found an interesting problem on https://www.codewars.com/kata/55beec7dd347078289000021:
Linked Lists - Length & Count

Implement Length() to count the number of nodes in a linked list.
Implement Count() to count the occurrences of an integer in a linked list.

I've decided to bundle these two functions within the same Kata since they are both very similar.

The `push()`/`Push()` and `buildOneTwoThree()`/`BuildOneTwoThree()` functions do not need to be redefined.

I tried it in Python, but could not do it. Can you solve it?

=====
Can you provide a the Python code you requested?
assistant
#Here is the Python code you requested.

class Node(object):
    def __init__(self, data):
        self.data = data
        self.next = None
    
def length(node):
    return 1 + length(node.next) if node else 0
  
def count(node, data):
    return (1 if node.data == data else 0) + count(node.next, data) if node else 0