<방법>
<파이썬 내장함수>
split() : 문자열을 쪼갬
>>> a = "Life is too short"
>>> a.split()
['Life', 'is', 'too', 'short'] #아무것도 인자로 넣어주지 않으면 공백을 쪼갬
>>> b = "a:b:c:d"
>>> b.split(':')
['a', 'b', 'c', 'd']
input() ⇒ 모두 문자열로 취급한다. 따라서 다른 형으로 쓸려면 형변환이 필요하다.
map(함수, 반복가능한 자료형(리스트, 튜플)): 자료형의 각 요소를 함수에 집어넣어 결과값을 돌려준다.
반환값은 map 객체이다. 이를 리스트 혹은 튜플로 변형시킬 수 있다.
# two_times.py
def two_times(numberList):
result = [ ]
for number in numberList:
result.append(number*2)
return result
result = two_times([1, 2, 3, 4])
print(result)