Light Mode
Dark Mode
TypeError: checkio() takes 1 positional argument b

I wrote the following code and get the error message: TypeError: checkio() takes 1 positional argument but 3 were given

def checkio(given_tuple):
    if len(given_tuple) < 2:
        return 0
    else:
        return float("{0:.3f}".format(max(given_tuple))) - float("{0:.3f}".format(min(given_tuple)))
print(checkio(1,2,3))

Why is the tuple (1,2,3) treated as 3 arguments instead of one, and how can I fix this? Thank you for the help in advance!

Created: Nov. 9, 2019, 10:02 a.m.
Updated: Nov. 10, 2019, 6:55 a.m.
0
9
User avatar
ivygreen28