Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

python 3.6 Notes / Assumptions / Requirements Don\'t import anything, and you ca

ID: 3857231 • Letter: P

Question

python 3.6

Notes / Assumptions / Requirements Don't import anything, and you can use all built-ins/methods that are otherwise available. * You may add as many additional methods and functions as you'd like in support of your solution. *str__and_repr__are used by many other places in Python to get a string representation of the object. Specifically, str() calls__str__, and repr() calls_repr_, on any objects they receive as arguments str__often generates a human-centric representation, appropriate for a human reading what is present repr-often generates a Python-centric representation. The goal of-repr-is actually to have a string that could be evaluated to re-generate an identical object. In general, we would quite prefer it to look like a valid constructor call, if possible. We can have the same representation in_str__ and_repr__ if we'd like; in fact, when we didn't explicitly describe two different string representations for_str_ and repr_ to return, we can define one in terms of the other, like this def-repr-(self): return str(self) Just remember the original intent of str vs repr. It's good practice to define init, str, and repr immediately before writing any extra methods in a Python class When representing a Moment, notice that we always go from largest to smallest units of time: yyyy/mm/dd-hh:mm. (There may be less than four columns for year, but the others are exact; pad with zeroes * wa * Exceptions - notice where we create exception types, and where we catch those exceptions. Be sure you don't catch the exception too early, or if not requested! When testing smaller parts of your code, it may be possible and even expected/required that specific inputs to a function/method will cause an exception to propagate, rather than returning normally with a return value. In the beginning of this specification, we described possible extensions to this program to make a full calendar application. This user interaction would be a great place to catch more exceptions and ask them to type in values again whenever we catch certain exception types. Since we're not writing the larger program that was described, there's no menu and user interaction present to do this particular style of interaction.

Explanation / Answer

Moment.py

TimeError.py