python if문 한 줄로 표현
if score >= 60: message = "success" else: message = "failure" message = "success" if score >= 60 else "failure" List comprehension >>> a = [1,2,3,4] >>> result = [] >>> for num in a: ... result.append(num*3) ... >>> print(result) [3, 6, 9, 12] >>> a = [1,2,3,4] >>> result = [num * 3 for num in a] >>> print(result) [3, 6, 9, 12] #짝수만 >>> a = [1,2,3,4] >>> result = [num * 3 for num in a if num % 2..