Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please type below very clearly and test before to submit the answer. the tester file. when done please run this tester and it will tell

please type below very clearly and test before to submit the answer.

the tester file. when done please run this tester and it will tell you how much the code pass.

tester link: https://mega.nz/file/LkwTXIDI#9c7c0XjFT2mRTJFSlg-Pm8v1cPhqL56RmG1wVztOt4M

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
What's Allowed? As long as you don't import anything, you can use anything built-in or that you create. Now that we're really writing our own datatypes, the built-ins aren't really designed to solve our quite-specic problems! . Don't import anything, and you can use all built-ins/methods that are otherwise available. O 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 always). . 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.Moment class: Instance Variables: year :: int Assume it's non-negative. month :: int expected: 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions

Question

why the griving process is more difficult for elders

Answered: 1 week ago

Question

Matlab Assignment

Answered: 1 week ago

Question

Pet animal example two?

Answered: 1 week ago

Question

The external auditory meatus extends up to?

Answered: 1 week ago

Question

What is the tympanic membrane also known as......?

Answered: 1 week ago