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:
Verified
Q1: When you evaluate a variable in IPython
Q2: Which of the following statements a), b)
Q3: Which of the following statements is false?
A)
Q4: Which of the following statements a), b)
Q5: Which of the following statements a), b)
Q7: Each new class you create becomes a
Q8: Which of the following statements a), b)
Q9: Properties look like _ to client-code programmers,
Q10: Which of the following statements is false?
A)
Q11: Which of the following statements is false?
A)
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents