dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
1.6 KiB
1.6 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 68b1f72371a5ac895ac70a02 | Challenge 40: Photo Storage | 29 | challenge-40 |
--description--
Given a photo size in megabytes (MB), and hard drive capacity in gigabytes (GB), return the number of photos the hard drive can store using the following constraints:
- 1 gigabyte equals 1000 megabytes.
- Return the number of whole photos the drive can store.
--hints--
number_of_photos(1, 1) should return 1000.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(number_of_photos(1, 1), 1000)`)
}})
number_of_photos(2, 1) should return 500.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(number_of_photos(2, 1), 500)`)
}})
number_of_photos(4, 256) should return 64000.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(number_of_photos(4, 256), 64000)`)
}})
number_of_photos(3.5, 750) should return 214285.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(number_of_photos(3.5, 750), 214285)`)
}})
number_of_photos(3.5, 5.5) should return 1571.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(number_of_photos(3.5, 5.5), 1571)`)
}})
--seed--
--seed-contents--
def number_of_photos(photo_size_mb, drive_size_gb):
return photo_size_mb
--solutions--
def number_of_photos(photo_size_mb, drive_size_gb):
drive_size_mb = drive_size_gb * 1000
return drive_size_mb // photo_size_mb