Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- """
- Create a program that given a requested number gives you
- the nearest number in a list.
- Considerations:
- - The list needs to only contain integers
- This example is useful when you have only a certain number of
- images sizes available and you have to pick one for your station
- collage.
- e.g.:
- >>> requested_size = 21
- >>> sizes = (1, 2, 3, 19, 29, 10, 22, 3)
- >>> main(requested_size, sizes)
- 22
- """
- def main(requested_size, sizes):
- """
- >>> requested_size = 120
- >>> sizes = (33, 50, 52, 75, 100, 175, 180, 182, 200, 350)
- >>> main(requested_size, sizes)
- 100
- """
- raise NotImplementedError('Write your code here')
- if __name__ == '__main__':
- import doctest
- doctest.testmod()
Add Comment
Please, Sign In to add comment