Python Map() 사용하기

파이썬 Built in Function Map()을 사용해 하나의 Function 을 여러항목에 적용할수있습니다.

사용법 : Map(펑션네임, 리스트)

Function

def temperature(T):

return (9.0/5)*T +32

List

list = [0, 25, 4.5, 40, 100]

Map (Function 이름만 씁니다 () 없이)

map(temperature, list)

결과 >> [32.0, 77.0, 40.1, 104.0, 212.0]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s