The assignment is to write a class called data. A Date object is intented to rep
ID: 3782913 • Letter: T
Question
The assignment is to write a class called data. A Date object is intented to represent a particuar date's month, day and year. It should be represented as an int.
---Write a constructor. You should assume that your constructor will be passed 3 parameters, representing the month, day, and year to be stored in the object. Each is an integer. For example:
>>> mlk_day = Date(1, 16, 2017)
>>> revolution = Date(7, 4, 1776)
>>> ny_eve = Date(12, 31, 2016)
Remember that when defining a constructor, we will always call its first parameter self, which refers to the object which is created.
Python 2.7.13
Explanation / Answer
class Data: def __init__(self, month, day, year): """ :param month: :param day: :param year: :return: """ self.month = month self.year = year; self.day = day s = Data(1,12,2017)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.