There is a typo in answer C. "var" should be capitalized "Var":
class Class:
Var = data = 1
def __init__(self,value):
self.prop = value
Object = Class(2)
print(len(Class.__dict__) == 1) # False
print("data" in Class.__dict__) # True
print("Var" in Class.__dict__) # True
print("data" in Object.__dict__) # False
print(Class.__dict__)
print("*************")
print(Object.__dict__)
print(isinstance(obj_b,A)) # ans A, The isinstance() function returns True
# if the specified object is of the specified type
# return false
print(A.VarA ==1) # ans B, A.VarA = 1, so A.VarA ==1. Then,it return true
print(obj_a is obj_aa) # ans C, return false
print(B.VarA == 1) # ans D, B.VarA = 2, so B.VarA not == 1. Then, it return false
The correct answer should be B,C
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
mazimir
Highly Voted 3 years, 1 month agodicksonpwc
Most Recent 1 year, 7 months agodicksonpwc
1 year, 7 months ago9prayer
1 year, 9 months agoJnanada
2 years, 3 months agomacxsz
2 years, 6 months agoAngel75
2 years, 9 months agoit_man_531
2 years, 10 months agoNoarmy315
2 years, 11 months agoDTL001
2 years, 11 months agovlobachevsky
3 years, 1 month ago