I just need help understanding why this is happening ^^
for this code where I'm just checking the class:
date = "1 11 2111"
def magic(string):
m,d,y = string.split()
return type(y)
print(magic(date))```
the answer come out as:
`<class 'str'>`
which makes sense because inside my function m,d,y do act like strings
but when I use endswith
```py
date = "1 11 2111"
def magic(string):
m,d,y = string.split()
return y.endswith(int(m)*int(d))
print(magic(date))```
I get an error:
`TypeError: endswith first arg must be str or a tuple of str, not int`
so for it to work I end up specifying that y is a string when it already is one ๐
why is this happening?