Why does class object have no attribute

Question:

Trying to build a Trie branch. I have looked at my indentation and there are no spaces, just tabs for that. I have also looked at other answers which either aren’t reproducible or have no effect. What am I doing wrong? I expect the following outcome:
*

trie.py

class Trie:
    def __int__(self):
        self.root = '*'

main.py

import trie_test


if __name__ == '__main__':
    trie = trie_test.Trie()
    print(f'trie root: {trie.root}')

Error

line 13, in <module>
    print(f'trie root: {trie.root}')
AttributeError: 'Trie' object has no attribute 'root'
Asked By: Nicholas Crook

||

Answers:

def __int__ should be def __init__.

Answered By: Jesse Anderson
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.