numbers = [1,2,3,4]; result = []
for num in numbers: result.append(num);
print(result); |
numbers = [1,2,3,4]; result = [num * 3 for num in numbers];
print(result); |
numbers = [1,2,3,4]; result = [num * 3 for num in numbers if num % 2 == 0];
print(result); |
result = [x * y for x in range(2, 10) for y in range(1, 10)];
print(result); |
'Python' 카테고리의 다른 글
python 함수2 (0) | 2019.09.02 |
---|---|
python 함수1 (0) | 2019.08.27 |
python while (0) | 2019.08.27 |
python for (0) | 2019.08.27 |
python if문 (0) | 2019.08.27 |