Created
February 22, 2017 15:24
-
-
Save ThomPuiman/1d2f01d32bf7f596a2f124103e8f54f4 to your computer and use it in GitHub Desktop.
Dailyprogrammer challenge: https://www.reddit.com/r/dailyprogrammer/comments/5bn0b7/20161107_challenge_291_easy_goldilocks_bear/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reqs = input() | |
| if len(reqs) > 0: | |
| splitted = reqs.split(" ") | |
| chairWeightReq = int(splitted[0]) | |
| porridgeTempReq = int(splitted[1]) | |
| availableChairs = [] | |
| currentInput = input() | |
| while len(currentInput) > 0: | |
| splitInput = currentInput.split(" ") | |
| availableChairs.append((int(splitInput[0]), int(splitInput[1]))) | |
| currentInput = input() | |
| #search for seats and add 2 because the first line was already extracted above | |
| foundElements = [str(i+2) for i, v in enumerate(availableChairs) if v[0] <= chairWeightReq and v[1] <= porridgeTempReq] | |
| print(' '.join(foundElements)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment