Knowee
Questions
Features
Study Tools

Traceback (most recent call last): File "/piston/jobs/e6a89de3-48e6-4609-8f0f-b250f44c7ea7/test.py", line 26, in <module> r=insert(r,val) File "/piston/jobs/e6a89de3-48e6-4609-8f0f-b250f44c7ea7/test.py", line 10, in insert if root.val<key:AttributeError: 'int' object has no attribute 'val'

Question

Traceback (most recent call last): File "/piston/jobs/e6a89de3-48e6-4609-8f0f-b250f44c7ea7/test.py", line 26, in <module> r=insert(r,val) File "/piston/jobs/e6a89de3-48e6-4609-8f0f-b250f44c7ea7/test.py", line 10, in insert if root.val<key:AttributeError: 'int' object has no attribute 'val'

🧐 Not the exact question you are looking for?Go ask a question

Solution

The error message you're seeing is because you're trying to access the 'val' attribute of an 'int' object. In Python, 'int' objects do not have a 'val' attribute.

This error typically occurs when you're trying to access an attribute or method on an object of the wrong type. In this case, it seems like you're expecting 'root' to be an object of a class that has a 'val' attribute, but it's actually an 'int'.

To fix this error, you need to make sure that 'root' is an object of the correct type before trying to access its 'val' attribute. You might need to check the part of your code where 'root' is defined or assigned.

This problem has been solved

Similar Questions

Traceback (most recent call last): File "/piston/jobs/49640095-2ad6-4c8f-ab6b-80772c4d7bd6/test.py", line 45, in <module> root=insert(root,n) File "/piston/jobs/49640095-2ad6-4c8f-ab6b-80772c4d7bd6/test.py", line 12, in insert root.right=insert(root.right,data) File "/piston/jobs/49640095-2ad6-4c8f-ab6b-80772c4d7bd6/test.py", line 12, in insert root.right=insert(root.right,data) File "/piston/jobs/49640095-2ad6-4c8f-ab6b-80772c4d7bd6/test.py", line 12, in insert root.right=insert(root.right,data) [Previous line repeated 994 more times] File "/piston/jobs/49640095-2ad6-4c8f-ab6b-80772c4d7bd6/test.py", line 8, in insert root=node(data)RecursionError: maximum recursion depth exceeded

Traceback (most recent call last): File "/piston/jobs/d413b623-c9e3-4b99-bce6-7b2152998a7f/test.py", line 23, in <module> solve(C, S) File "/piston/jobs/d413b623-c9e3-4b99-bce6-7b2152998a7f/test.py", line 9, in solve root = vars(S)TypeError: vars() argument must have __dict__ attribute

Traceback (most recent call last): File "/piston/jobs/523fac8c-c241-4a64-a680-846fde87075d/test.py", line 19, in <module> r=[list(map(int,input().split())) for _ in range(m)] File "/piston/jobs/523fac8c-c241-4a64-a680-846fde87075d/test.py", line 19, in <listcomp> r=[list(map(int,input().split())) for _ in range(m)]EOFError: EOF when reading a line

Traceback (most recent call last): File "/piston/jobs/1450026b-af8e-4326-8a94-b64bb21e590c/test.py", line 29, in <module> inorder(r,l) File "/piston/jobs/1450026b-af8e-4326-8a94-b64bb21e590c/test.py", line 17, in inorder inorder(root.left)TypeError: inorder() missing 1 required positional argument: 'l'

Traceback (most recent call last): File "/piston/jobs/73cd8974-25a8-40b2-93f5-40ecd87f6049/test.py", line 21, in <module> a.append(int(input()))ValueError: invalid literal for int() with base 10: '1 2 3 4 5 6'

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.