Solved

Which of the Following Statements Is False

Question 31

Multiple Choice

Which of the following statements is false?


A) Methods commonly use a class's attributes to get the values of those attributes.
B) We also can use a class's attributes to modify their values.
C) Consider the Account object in the following IPython session:
In [1]: from account import Account
In [2]: from decimal import Decimal
In [3]: account1 = Account('John Green', Decimal('50.00') )
In [4]: account1.balance
Out[4]: Decimal('50.00')
Initially, account1 contains a valid balance. The following code shows that we can set the balance attribute to an invalid negative value, then display the balance:
In [5]: account1.balance = Decimal('-1000.00')
In [6]: account1.balance
Out[6]: Decimal('-1000.00')
D) Like methods, data attributes can validate the values you assign to them.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions