Question: python please Suppose you are given the following Python class that represents a date: In [ ]: class Date: format_str = lambda: [day]/(month)/(year} def __init__(self,
![a date: In [ ]: class Date: format_str = lambda: "[day]/(month)/(year}" def](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/10/6703fda683b8b_7906703fda61ac42.jpg)
Suppose you are given the following Python class that represents a date: In [ ]: class Date: format_str = lambda: "[day]/(month)/(year}" def __init__(self, day, month, year): self day - day self.month month self. year " year dor str_(self): YOUR CODE HERE pass def repr_(self): return self._stro The Date class contains a class variable named format_str, which must be a parameterless function that returns a format renresentation of a given Date obiect The Date class contains a class variable named format_str, which must be a parameterless function that returns a format string, on which the str.format() function will be called to produce a representation at a given Date object, Your job is to implement the_str_0) method properly so that, no matter what kind of format date format stro) function raturna, the method will take that format into account. All you really need to write is one line of codell! Examples: >>> Oute ( 12, 28, 2021 ) 12/28/2021 If we wish to display only the month and the yout, we can do the following >>> Date. formatstr. lambda: "(month/year)" >>> Datet 1, 10, 1990) 10/1990 We can change the delimiter symbol easily >>> Date. format_tr lambda "year) (month: 020) (dayrozd}" >>> Date 3, 5, 2004) 2004-05-23
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
