Using Visual Studio & http://pythontutor.com/visualize I am unable to get the result for filesize function because of the following Error: TypeError: file_size() takes 1 positional argument but 3 were given. Code below.
#this function stores information about a file, its name, its type and its size in bytes. def file_size(file_info): name, file_type, size = file_info return("{:.2f}".format(size/1024)) print(file_size('Class Assignment','docx', 17875)) #Should print 17.46 print(file_size('Notes','txt', 496)) #Should print 0.48 print(file_size('Program','py', 1239)) #Should print 1.21 I though unpacking (file_info) within the function will override the 1 positional argument but 3 were given error. What am I doing wrong?
def file_size(*file_info):if you want to call the function this way.