[Python] 해커랭크(HackerRank) : List Comprehensions
[문제] list를 연습하는 문제입니다. 먼저 x, y, z, n이라는 정수가 순차적으로 입력됩니다. x는 list[0]의 최댓값, y는 list[1]의 최댓값, z는 list[2]의 최댓값이 되며, 0부터 각 최댓값까지의 숫자들이 조합돼서 리스트가 생성 및 출력됩니다. 다만 각 리스트의 숫자 합이 n이 될 경우, 출력되지 않습니다. 예시) 입력값 : 1112 출력값: [[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 1]] [코드] if __name__ == '__main__': x = int(input()) y = int(input()) z = int(input()) n = int(input()) print([[i, j, k] for i in range(x+..
2023. 2. 19.