I made an object and a variable outside a function but I am able to use it inside a function I was just messing around the code and I noticed this ps I was trying to make a linked list
this is the rest of the code I cant add another image here
ll=Linkedlist()
first=Node(1)
Second=Node(2)
Third=Node(3)
ll.head=first
first.next=Second
Second.next=Third
ll.tail=Third
x=4
def display():
ll.trav()
print(x)
display()
my question now is how am I able to use ll
and x=4
in the function display
when both are defined outside the function