Adding Years, Months, and Days to a Delorean Object

  • Share this:

Code introduction


This function accepts a Delorean object and then adds a specific number of hours, minutes, seconds, years, months, and days to it.


Technology Stack : Delorean

Code Type : Function

Code Difficulty : Intermediate


                
                    
from delorean import Delorean, Period

def add_years_months_days(hours, minutes, seconds, years, months, days):
    """
    This function takes a Delorean object and adds a specific number of years, months, and days to it.
    """
    delorean = Delorean()
    delorean.add(hours, minutes, seconds)
    delorean.add_period(Period(years=years, months=months, days=days))
    return delorean                
              
Tags: