刷刷Python基本功...列表解析
附上代码:
1 x = int(input())
2 y = int(input())
3 z = int(input())
4 n = int(input())
5 print [[i, j, k] for i in xrange(x+1) for j in xrange(y+1) for k in xrange(z+1) if i+j+k != n]
hackerrank---List Comprehensions,布布扣,bubuko.com
时间: 2024-10-31 00:35:34