+ 1

Fill in the blanks to make the egg attribute strongly private and access it from outside of the class

class Test: __egg = 7 t = Test() print(t._Test_____)

30th Nov 2022, 4:25 AM
Beterus
2 odpowiedzi
+ 1
A strongly private attribute can be accessed as following: class Test: __egg = 10 t = Test() print(t._Test__egg) Note that you can always see the list of a Class attributes by using the dir() function E.g: print(dir(t))
30th Nov 2022, 9:18 AM
Abdelrahman Tlayjeh
0
Thanks
30th Nov 2022, 5:06 PM
Beterus