Computer Science/알고리즘 ( Algorithm )

[python] list 가지고 놀기

bugtype 2018. 12. 22. 13:28

numberList = list([x for x in range(1,10)])
numberList2 = list([str(x) for x in range(1,10) if x % 2 == 0])
numberList3 = list(map(lambda x: x+3, numberList))
numberList4 = [1,2] + numberList

print(numberList)
print(numberList2)
print(numberList3)
print(numberList4)


[1, 2, 3, 4, 5, 6, 7, 8, 9]

['2', '4', '6', '8']

[4, 5, 6, 7, 8, 9, 10, 11, 12]

[1, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9]



'Computer Science > 알고리즘 ( Algorithm )' 카테고리의 다른 글

Codility - Nesting  (0) 2019.03.11
Codility - CyclicRotation  (0) 2019.03.11
Codility - Binary gap  (0) 2019.03.11
카카오 오픈채팅방  (0) 2019.01.30
python string 다루기  (0) 2019.01.01