160k views
4 votes
Does the following python code have a local and global variable??

class fish:
name='Salmon'
presanceinallofak='true'
def display(self):
print (self.name)
print (self.age)
s1 = student()

print (getattr(s1,'name'))
print ("\\")
print("Presance in all parts of Alaska")
print (hasattr(s1,'name'))
print ("\\")

User JsPlayer
by
5.2k points

1 Answer

4 votes

Answer:

salmon is true

salmon age

salmon name

return ;0

User Madreflection
by
5.1k points