problem in Python property setter/getter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
29th Apr 2020, 12:26 PM
Piyush Duggal
Piyush Duggal - avatar
2 Answers
+ 8
From line 19 pineapple_allowed which contains *False* is attempted to changed using setter decorator. The new def function has another argument as "value". This parameter corresponds to the return value of pineapple_allowed. Next we have statement: 'if value:' which has the boolean*false*(because value = False) , therefore it never executes. This concludes that setter function never executes because at starting it was False. So the values for pineapple_allowed will not be determined by setter. This whole thing is bit complex to explain. I suggest you to take help from external websites about setter/getter.
29th Apr 2020, 1:49 PM
Valmob101
Valmob101 - avatar
+ 1
what is the problem actually
29th Apr 2020, 12:36 PM
durian
durian - avatar