需要帮助解决函数中的这个问题

Need assistance solving this issue in a function

我有一项计算机科学作业 class,需要帮助修复一个功能,但我不知道哪里出了问题!该函数称为 'days_left'。此函数接受三个变量,日、月和年。它应该输出那一年剩下多少天。我已尽力而为,但无法弄清楚!任何帮助将不胜感激。这是脚本:

def leap_year(year):
    if (year % 4) == 0:
        if (year % 100) == 0:
            if (year % 400) == 0:
                return True
            else:
                return False
        else:
            return True
    else:
        return False
 
 
def number_of_days(month, year):
    days31 = [1, 3, 5, 7, 8, 10, 12]
    days30 = [4, 6, 9, 11]
    if month in days31:
        return 31
    elif month in days30:
        return 30
    else:
        if not leap_year(year):
            return 28
        else:
            return 29
 

def days_left(month, day, year):
    days = 0
    for i in range(1, month):
        days += number_of_days(i, year)
    days += day
    for x in range(year):
        if leap_year(year):
            return 366 - days
        else:
            return 365 - days

if __name__ == '__main__':
    print("Please enter a date: \n")
 
    d = int(input("Day: "))
    m = int(input("Month: "))
    y = int(input("Year: "))
 
    print("\nMenu:")
    print("1) Calculate the number of days in the given month.")
    print("2) Calculate the number of days left in the given year.")
    selection = int(input())
 
    if selection == 1:
        print(number_of_days(m, y))
    elif selection == 2:
        print(days_left(d, m, y))
    else:
        print('')
def days_left(day, month, year):

它应该是 'day, month' 而不是 'month, day' 因为你是用 days_left(d, m, y)

调用函数