How do I fill in the blanks to make the egg attribute strongly private and access it from outside of the class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How do I fill in the blanks to make the egg attribute strongly private and access it from outside of the class?

I just don't understand how you do it. class Test: __egg = 7 t = Test() print(t._Test_____)

1st Nov 2020, 10:50 PM
Vicious Playz
Vicious Playz - avatar
2 Answers
+ 1
@property is not answer 😂😂
7th Dec 2020, 5:59 PM
tieflabs
tieflabs - avatar
- 1
to access the private attribute you prefix them with the undescore and name of their class. Like this: print(t._Test__egg)
2nd Nov 2020, 4:02 AM
Volodymyr Chelnokov
Volodymyr Chelnokov - avatar