Storage Quota Check
Before uploading files, it is useful to check whether they fit into the available storage quota. Given file sizes sizes in bytes and a byte limit quota, return True if the total size of all files does not exceed the quota. If there are no files, their total size is 0.
Примеры
Ввод
[100, 200, 300], 1000Вывод
TrueВвод
[500, 600], 1000Вывод
FalseВвод
[], 0Вывод
TrueНужно реализовать
def fits_quota(sizes, quota):
Теги
arraylistsmath
Přihlaste se, abyste viděli historii odevzdání
Přihlásit sePřihlaste se, abyste mohli použít AI mentora
Přihlásit seVisible tests
1
Input
[100,200,300], 1000Expected
True2
Input
[500,600], 1000Expected
False3
Input
[], 0Expected
True4
Input
[1000], 1000Expected
True5
Input
[1,1,1], 2Expected
False6
Input
[100,200,300], 0Expected
FalseFocus radio
Paused · SomaFM · Fluid