The following code and traceback shows that our class Time's hour property xe "validate data"validates the values you assign to it: In [10]: wake_up.hour = 100
---------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-10-1fce0716ef14> in <module>()
----> 1 wake_up.hour = 100
~/Documents/examples/ch10/timewithproperties.py in hour(self, hour)
20 """Set the hour."""
21 if not (0 <= hour < 24) :
---> 22 raise ValueError(f'Hour ({hour}) must be 0-23')
23
24 self._hour = hour
ValueError: Hour (100) must be 0-23
Which of the following statements a) , b) or c) is false?
A) The code attempts to set the hour property to an invalid value.
B) The code checks that the hour property is in the range 0 through 24.
C) The value 100 is out of range so the code raises a ValueError.
D) All of the above statements are true.
Correct Answer:
Verified
Q30: Consider the following code from our class
Q31: Which of the following statements a), b)
Q32: A read-only property has _.
A) only a
Q33: Consider the following code which would set
Q34: Properties are implemented as _, so they
Q36: Which of the following statements a), b)
Q37: Class Time's properties and methods define the
Q38: Which of the following statements a), b)
Q39: Which of the following statements is false?
A)
Q40: Which of the following statements a), b)
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