Question: I'm making a simple program in order to compare the currentdate to another date, and I need to separate the "/" and remove trailing zeros; I made a function for that:

```
def correctdate(compare, Dayslist, Monthslist):
    for day in compare:

        if day == "/" or day == "\\":
            compare.remove(day)
            break
        else:          
            Dayslist.append(day)

    for removenum in Dayslist:
        #* Removing the numbers from the list
        compare.remove(removenum)

    for month in compare:
        Monthslist.append(month)

    #* Joining the numbers into a string
    correctdate.DaysLeft = "".join(Dayslist)
    correctdate.MonthsLeft = "".join(Monthslist)
    #* Stripping leading zeros
    correctdate.DaysLeft = correctdate.DaysLeft.lstrip("0")
    correctdate.MonthsLeft = correctdate.MonthsLeft.lstrip("0")

    return

```

The code works just fine but i want to save the `DaysLeft, Monthsleft` to print it/edit it ETC..
so i do this:

```
        correctdate(compare,Dayslist,Monthslist)
        print(correctdate.Daysleft)

```

and i get this:

```
AttributeError: 'function' object has no attribute 'Daysleft'

```

Answer: 
You ve to return it in your function, and outside it get it into variables:

```
def correctdate(compare, Dayslist, Monthslist):
for day in compare:

    if day == "/" or day == "\\":
        compare.remove(day)
        break
    else:          
        Dayslist.append(day)

for removenum in Dayslist:
    #* Removing the numbers from the list
    compare.remove(removenum)

for month in compare:
    Monthslist.append(month)

#* Joining the numbers into a string
correctdate.DaysLeft = "".join(Dayslist)
correctdate.MonthsLeft = "".join(Monthslist)
#* Stripping leading zeros
correctdate.DaysLeft = correctdate.DaysLeft.lstrip("0")
correctdate.MonthsLeft = correctdate.MonthsLeft.lstrip("0")

return  correctdate.DaysLeft,correctdate.MonthsLeft

```

This for return outside function, now you ve to call function correctly:

```
    DaysLeft,Monthsleft = correctdate(compare,Dayslist,Monthslist)
    print(DaysLeft,Monthsleft)

```

Anyway this code "correctdate.MonthsLeft" looks like you want use class and not only functions, so you should use like that <https://www.w3schools.com/python/python_classes.asp>
```
def correctdate(compare, Dayslist, Monthslist):

```

You declare a function with name `correctdate` that accepts 3 parameters.

```
correctdate.DaysLeft = "".join(Dayslist)
correctdate.MonthsLeft = "".join(Monthslist)

```

Then you try to assign a value to a function, which is not possible because `correctdate` is not a variable, not an object. You just declared it as a function.

What are you trying to achieve?