[English] 수 / 양

I’ve made tons of friends since I started doing Facebook.: 페이스북을 하면서 친구가 엄청나게 늘었지.
I have tons of work.
I have tons of pictures of my son.
I don’t have tons of many friends.
I have tons of shoes / jeans.
tons / files / heaps(호주에서 많이 씀) of ~ 와 같이 씀.
millions / tons of ~
gazillion, bazillion: ‘방대한 수’ 를 나타내는 재밌는 넌센스의 말.

I’d better pick up some food on my way home from work.: 퇴근하고 집에 가는 길에 음식을 좀 사가야겠다.
food: 셀 수 없는 명사. one food, two food 안됨.
coffee: 역시 셀 수 없는 명사. a coffee = a cups of coffee를 줄인 것.
clothes: 역시 셀 수 없는 명사. a shirt, one pair of pants로 써도 됨. 그러나 one clothes는 안됨.

There are hundreds of applications to choose from the APP store. : 앱스토어에 고를 수 있는 애플리케이션이 수백개야.
hundreds of 는 진짜 있는 좀 현실적인 값. 충분히 그럴 수 있다. 그러나 문맥에 따라 ‘아주 많은’의 뜻으로 쓸 수 있다.

[English] 거리

The cafe is about a five minute walk from here.: 그 카페 여기서 걸어서 5분 거리야.
a walk: 걷기, 걸음 이란 의미의 명사.
I’m going to take a walk
a five-minute drive: drive도 명사. It’s an hour drive. h는 묵음이므로 an이 붙음.
a five-minute ride 도 됨. bus 같은 것.
It’s about a thirty-minute drive without traffic / with traffic: 길이 막히면, 길이 안막히면.

My friend lives two stations away.: 내 친구는 2 역 떨어져 있다.
~ away: ~만큼 떨어져있다.
bus stop도 마찬가지. two (bus) stops away
two or five blocks away: 미국에선 block도 쓰므로.. 큰 사거리에서 다음 큰 사거리까지.

I want to live far from the city.: 도시에서 멀리 살고 싶다.
반대말로 close to the city.
I live close to work: 회사에 가까이 살고 싶다.

[Python] matplotlib.pyplot 으로 그래프 그리기

import 부터 하자.

import matplotlib.pyplot as pyplot

하나는 x 축, 다른 하나는 y 축으로 리스트 두개를 가지고 그린다. 예를 보자. scatter()를 썼다.

names = ['Bamtol', 'Mong', 'Justin', 'Jay']
bomb = [8, 1, 12, 10]
pyplot.title('Super Mario Cart 8 Deluxe Score')
pyplot.xlabel('Name')
pyplot.ylabel('Score')
pyplot.scatter(names, bomb, color='green')
pyplot.show()

위의 그래프는 막대 그래프가 더 나아보인다. bar()로 막대 그래프를 그래보자. 각각의 색도 바꿔보자.

names = ['Bamtol', 'Mong', 'Justin', 'Jay']
bomb = [8, 1, 12, 10]
pyplot.title('Super Mario Cart 8 Deluxe Score')
pyplot.xlabel('Name')
pyplot.ylabel('Score')
pyplot.bar(names, bomb, color=[ 'blue', 'red', 'gray', 'green' ])
pyplot.show()

barh()를 쓰면 누은 그래프가 나온다. xlabel()과 ylabel() 바꿔주자.

names = ['Bamtol', 'Mong', 'Justin', 'Jay']
bomb = [8, 1, 12, 10]
pyplot.title('Super Mario Cart 8 Deluxe Score')
pyplot.xlabel('Score')
pyplot.ylabel('Name')
pyplot.barh(names, bomb, color=[ 'blue', 'red', 'gray', 'green' ])
pyplot.show()

plot()을 쓰면 선 그래프가 나온다.

weigh = [ 3.26, 4.5, 5.6, 7.2, 8.9, 10.4, 12.6, 14.2, 16.1, 17.4, 16.8, 16.3, 16.5, 17.0]
pyplot.plot(weigh)
pyplot.title("Bamtol's weigh")
pyplot.xlabel('Days')
pyplot.ylabel('Kg')
pyplot.show()

그려진 그래프의 시작이 1이 아닌 0 부터임에 주의하자. 이걸 1부터로 바꾸고, x 축 찍는 위치도 바꾸고, 마커도 넣어보자.

weigh = [ 3.26, 4.5, 5.6, 7.2, 8.9, 10.4, 12.6, 14.2, 16.1, 17.4, 16.8, 16.3, 16.5, 17.0]
axis_x = list(range(1, 15))
pyplot.title("Bamtol's weigh")
pyplot.xlabel('Days')
pyplot.ylabel('Kg')
pyplot.plot(axis_x, weigh, marker = '.', color = 'green')
pyplot.xticks([1, 4, 7, 10, 13])
pyplot.show()

파이 차트를 그릴 때는 pie()를 이용한다.

names = ['Bamtol', 'Mong', 'Justin', 'Jay']
bomb = [8, 1, 12, 10]
pyplot.title('Results: Score', fontdict={'fontsize': 24})
pyplot.pie(bomb, labels=names, autopct='%1.1f%%', colors=['lightblue','pink','yellow','lightgreen'])

[Python] sorted() 설명

sorted() 함수는 iterable로 정렬한 list를 만든다. doc string을 보자.

Return a new list containing all items from the iterable in ascending order.

A custom key function can be supplied to customize the sort order, and the reverse flag can be set to request the result in descending order.

설명에서 보이는대로 key로 function을 받아 그 function의 기준에 따라 정렬 가능하다. 순서를 작아지는 순서로 하고 싶다면, reverse 를 True로 주면 된다. 예를 들면 다음과 같다.

names = [ 'Bamtol', 'Mong', 'Justin', 'Jay']
sorted(names)
['Bamtol', 'Jay', 'Justin', 'Mong']

key를 len()으로 주고, 작아지는 순서대로 해보자.

sorted(names, key=len, reverse=True)
['Bamtol', 'Justin', 'Mong', 'Jay']

[Python] filter() 설명

filter() 함수는 iterables 안의 어떤 조건(함수)에 맞는 것만 골라내는 함수다. doc string을 보자.

filter(function or None, iterable) –> filter object

Return an iterator yielding those items of iterable for which function(item) is true. If function is None, return the items that are true.

어떤 iterables내의 item들 중 function에 참인 것만 골라서 iterator를 만든다. function에 None을 주면 true인 item들만 고른다. 예를 들면 다음과 같다.

names = [ 'Bamtol', 'Mong', 'Justin', 'Jay']
list(filter(lambda x: len(x) == 6, names))
['Bamtol', 'Justin']

[Python] map() 설명

map() 함수의 doc string부터 보자.

map(func, *iterables) –> map object

Make an iterator that computes the function using arguments from each of the iterables. Stops when the shortest iterable is exhausted.

설명 그대로 func 함수를 iterables내의 각 argument에 적용한 iterator를 만든다. 예를 들면 다음과 같다. 일부러 for loop를 돌렸다. 쓰인 len이 length를 return하는 len()임에 주의하자.

names = [ 'Bamtol', 'Mong', 'Justin', 'Jay' ]
for length in map(len, names):
    print(length)
6
4
6
3

iterator를 return하므로 list로 만들고 싶다면 list로 변환한다.

list(map(len, names))
[6, 4, 6, 3]

[English] 형태/모양

일반적으로 미국에서는 외모, 특히 얼굴 모양, 크기에 대한 이야기를 거의! 하지 않음을 주의하자.
Why would you say that?

She has a really round face: 그녀는 정말 얼굴이 동글동글해
oval : circle 아니고 길쭉한.
square face: 사각턱
a sqaure jaw line: 각이 진 턱선. 남성다움의 뜻으로 약간 좋게 생각한다.
wide / small / crooked / pointy / flat nose: 넓은, 작은, 구부러진, 뾰족한, 편평한 코. 코는 많이 얘기하는 편.

Cell phones are so thin and compact these days.
thin: 얇다. 사람에 대해서는 날씬하다/늘씬하다의 뜻. skiny는 말랐다의 느낌.
compact: a compact car(소형차).
notebook, laptop: notebook은 laptop의 한 종류. 더 작은 거.

Our new office building is perfectly cylindrical.: 원통형. 길고 동그랗다.
rectangle / triangle / octagon: 삼각형 / 사각형 / 팔각형
triangular: 삼각형 모양의 (형용사)