size1 and size2 are the sizes of two files, and space is the amount of available space on a flash drive. Write a function that takes these integer numbers as arguments and figures out the largest combination of files that fits on a flash drive. The method should return 3 if both files fit together, the file number (1 or 2) corresponding to the longest file that fits by itself (1 if the files are the same size), or 0 if neither file fits on the flash drive.
Your function must have only one return statement
def maximum(a, b, c):
if (a >= b) and (a >= c):
largest = a
elif (b >= a) and (b >= c):
largest = b
else:
largest = c
return largest
a = 10
b = 14
c = 12
print(maximum(a, b, c))
Comments
Leave a comment