@Python_Dv List = [1, 0, 2]
a, b, c = List[::-1]
print(List[b])
B) 1
# using List[::-1] reverses the list [2, 0, 1]
print List[b] , b has the value 0
result List[0] is now 1
@Python_Dv List = ['python', 'developers']
result = [i for i in List if len(i)>6]
print(*result)
B) developers
# developers meets the if len(i)>6 condition developers(10) so prints developers
@Python_Dv class Test:
def __init__(self, __id):
self.__id = 101
test = Test(102)
D) ERROR.
When you define an attribute with double underscores(__id), python changes the name to _Test__id to avoid name clashes in subclasses so you get an error.
print(test.__id)