에리히 프롬의 핵심 내용을 교육용으로 재구성한 영어·한글 200문장을 활용하여 파이썬 자료구조, 제어문, 함수, 객체지향 프로그래밍을 단계적으로 학습합니다.
총 200예제4개 영역 × 50개영어 한 줄 · 한글 한 줄코드·결과·설명 포함
책의 원문을 옮긴 것이 아니라 핵심 주제를 교육 목적으로 재구성한 문장과 파이썬 학습 예제입니다.
01
리스트 · 튜플 · 딕셔너리 · 집합
문장을 다양한 자료구조에 저장하고 조회·변환합니다.
예제 001
리스트 생성과 인덱싱
Erich Fromm begins by challenging the belief that love is mainly a matter of luck.
에리히 프롬은 사랑이 주로 운의 문제라는 믿음에 의문을 제기하며 이야기를 시작한다.
파이썬 코드
sentences = ['Erich Fromm begins by challenging the belief that love is mainly a matter of luck.', '에리히 프롬은 사랑이 주로 운의 문제라는 믿음에 의문을 제기하며 이야기를 시작한다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Erich Fromm begins by challenging the belief that love is mainly a matter of luck.
에리히 프롬은 사랑이 주로 운의 문제라는 믿음에 의문을 제기하며 이야기를 시작한다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 002
튜플로 고정 자료 묶기
He argues that many people want to be loved more than they want to learn how to love.
그는 많은 사람이 사랑하는 법을 배우기보다 사랑받기를 더 원한다고 주장한다.
파이썬 코드
sentence_pair = ('He argues that many people want to be loved more than they want to learn how to love.', '그는 많은 사람이 사랑하는 법을 배우기보다 사랑받기를 더 원한다고 주장한다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
He argues that many people want to be loved more than they want to learn how to love.
그는 많은 사람이 사랑하는 법을 배우기보다 사랑받기를 더 원한다고 주장한다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 003
딕셔너리의 키와 값
People often treat love as a pleasant feeling that should happen automatically.
사람들은 흔히 사랑을 저절로 생겨야 하는 즐거운 감정으로 여긴다.
파이썬 코드
sentence = {
"number": 3,
"english": 'People often treat love as a pleasant feeling that should happen automatically.',
"korean": '사람들은 흔히 사랑을 저절로 생겨야 하는 즐거운 감정으로 여긴다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
3
People often treat love as a pleasant feeling that should happen automatically.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 004
집합으로 핵심 단어 중복 제거
Fromm says that genuine love requires knowledge, effort, and disciplined practice.
In this sense, loving resembles learning music, painting, or medicine.
이런 의미에서 사랑은 음악, 회화, 의학을 배우는 일과 비슷하다.
파이썬 코드
sentences = ['In this sense, loving resembles learning music, painting, or medicine.', '이런 의미에서 사랑은 음악, 회화, 의학을 배우는 일과 비슷하다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
In this sense, loving resembles learning music, painting, or medicine.
이런 의미에서 사랑은 음악, 회화, 의학을 배우는 일과 비슷하다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 006
튜플로 고정 자료 묶기
A person cannot master an art by depending only on spontaneous emotion.
사람은 순간적인 감정에만 의존해서는 어떤 기술도 익힐 수 없다.
파이썬 코드
sentence_pair = ('A person cannot master an art by depending only on spontaneous emotion.', '사람은 순간적인 감정에만 의존해서는 어떤 기술도 익힐 수 없다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
A person cannot master an art by depending only on spontaneous emotion.
사람은 순간적인 감정에만 의존해서는 어떤 기술도 익힐 수 없다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 007
딕셔너리의 키와 값
The learner must understand both the theory and the practice of the art.
배우는 사람은 그 기술의 이론과 실제를 모두 이해해야 한다.
파이썬 코드
sentence = {
"number": 7,
"english": 'The learner must understand both the theory and the practice of the art.',
"korean": '배우는 사람은 그 기술의 이론과 실제를 모두 이해해야 한다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
7
The learner must understand both the theory and the practice of the art.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 008
집합으로 핵심 단어 중복 제거
Modern people often focus on finding the right object of love.
Fromm shifts attention from the object of love to the capacity to love.
프롬은 관심을 사랑의 대상에서 사랑할 수 있는 능력으로 옮긴다.
파이썬 코드
sentences = ['Fromm shifts attention from the object of love to the capacity to love.', '프롬은 관심을 사랑의 대상에서 사랑할 수 있는 능력으로 옮긴다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Fromm shifts attention from the object of love to the capacity to love.
프롬은 관심을 사랑의 대상에서 사랑할 수 있는 능력으로 옮긴다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 010
튜플로 고정 자료 묶기
The central question is not only whom we love but how maturely we love.
핵심 질문은 누구를 사랑하느냐뿐 아니라 얼마나 성숙하게 사랑하느냐이다.
파이썬 코드
sentence_pair = ('The central question is not only whom we love but how maturely we love.', '핵심 질문은 누구를 사랑하느냐뿐 아니라 얼마나 성숙하게 사랑하느냐이다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
The central question is not only whom we love but how maturely we love.
핵심 질문은 누구를 사랑하느냐뿐 아니라 얼마나 성숙하게 사랑하느냐이다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 011
딕셔너리의 키와 값
Love is presented as an active power rather than a passive experience.
사랑은 수동적인 경험이 아니라 능동적인 힘으로 제시된다.
파이썬 코드
sentence = {
"number": 11,
"english": 'Love is presented as an active power rather than a passive experience.',
"korean": '사랑은 수동적인 경험이 아니라 능동적인 힘으로 제시된다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
11
Love is presented as an active power rather than a passive experience.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 012
집합으로 핵심 단어 중복 제거
To love is to give life, attention, and meaning to another person.
Giving does not necessarily mean losing or becoming poorer.
주는 행위가 반드시 잃거나 가난해지는 것을 뜻하지는 않는다.
파이썬 코드
sentences = ['Giving does not necessarily mean losing or becoming poorer.', '주는 행위가 반드시 잃거나 가난해지는 것을 뜻하지는 않는다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Giving does not necessarily mean losing or becoming poorer.
주는 행위가 반드시 잃거나 가난해지는 것을 뜻하지는 않는다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 014
튜플로 고정 자료 묶기
For a productive person, giving expresses vitality and inner abundance.
생산적인 사람에게 주는 행위는 생명력과 내적 풍요를 나타낸다.
파이썬 코드
sentence_pair = ('For a productive person, giving expresses vitality and inner abundance.', '생산적인 사람에게 주는 행위는 생명력과 내적 풍요를 나타낸다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
For a productive person, giving expresses vitality and inner abundance.
생산적인 사람에게 주는 행위는 생명력과 내적 풍요를 나타낸다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 015
딕셔너리의 키와 값
True giving awakens something valuable in both people.
진정한 나눔은 두 사람 모두의 내면에서 가치 있는 것을 깨운다.
파이썬 코드
sentence = {
"number": 15,
"english": 'True giving awakens something valuable in both people.',
"korean": '진정한 나눔은 두 사람 모두의 내면에서 가치 있는 것을 깨운다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
15
True giving awakens something valuable in both people.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 016
집합으로 핵심 단어 중복 제거
Love therefore creates connection without erasing individuality.
It allows two people to become united while remaining distinct persons.
사랑은 두 사람이 서로 다른 인격체로 남으면서 하나가 되게 한다.
파이썬 코드
sentences = ['It allows two people to become united while remaining distinct persons.', '사랑은 두 사람이 서로 다른 인격체로 남으면서 하나가 되게 한다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
It allows two people to become united while remaining distinct persons.
사랑은 두 사람이 서로 다른 인격체로 남으면서 하나가 되게 한다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 018
튜플로 고정 자료 묶기
This balance between union and independence is essential to mature love.
결합과 독립 사이의 이러한 균형은 성숙한 사랑에 필수적이다.
파이썬 코드
sentence_pair = ('This balance between union and independence is essential to mature love.', '결합과 독립 사이의 이러한 균형은 성숙한 사랑에 필수적이다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
This balance between union and independence is essential to mature love.
결합과 독립 사이의 이러한 균형은 성숙한 사랑에 필수적이다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 019
딕셔너리의 키와 값
Without this balance, attachment can become dependence or domination.
이 균형이 없으면 애착은 의존이나 지배로 변할 수 있다.
파이썬 코드
sentence = {
"number": 19,
"english": 'Without this balance, attachment can become dependence or domination.',
"korean": '이 균형이 없으면 애착은 의존이나 지배로 변할 수 있다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
19
Without this balance, attachment can become dependence or domination.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 020
집합으로 핵심 단어 중복 제거
The book asks readers to examine whether they truly practice the art of loving.
Fromm connects the need for love with the human experience of separation.
프롬은 사랑의 필요를 인간이 느끼는 분리의 경험과 연결한다.
파이썬 코드
sentences = ['Fromm connects the need for love with the human experience of separation.', '프롬은 사랑의 필요를 인간이 느끼는 분리의 경험과 연결한다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Fromm connects the need for love with the human experience of separation.
프롬은 사랑의 필요를 인간이 느끼는 분리의 경험과 연결한다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 022
튜플로 고정 자료 묶기
Human beings are aware that they are separate from nature and from one another.
인간은 자신이 자연과 다른 사람들로부터 분리된 존재임을 의식한다.
파이썬 코드
sentence_pair = ('Human beings are aware that they are separate from nature and from one another.', '인간은 자신이 자연과 다른 사람들로부터 분리된 존재임을 의식한다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
Human beings are aware that they are separate from nature and from one another.
인간은 자신이 자연과 다른 사람들로부터 분리된 존재임을 의식한다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 023
딕셔너리의 키와 값
This awareness can produce loneliness, anxiety, and a sense of powerlessness.
이러한 의식은 외로움과 불안, 무력감을 낳을 수 있다.
파이썬 코드
sentence = {
"number": 23,
"english": 'This awareness can produce loneliness, anxiety, and a sense of powerlessness.',
"korean": '이러한 의식은 외로움과 불안, 무력감을 낳을 수 있다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
23
This awareness can produce loneliness, anxiety, and a sense of powerlessness.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 024
집합으로 핵심 단어 중복 제거
People search for ways to overcome the pain of isolation.
Some seek temporary unity through intoxication or intense excitement.
어떤 사람들은 술이나 강렬한 흥분을 통해 일시적인 결합을 추구한다.
파이썬 코드
sentences = ['Some seek temporary unity through intoxication or intense excitement.', '어떤 사람들은 술이나 강렬한 흥분을 통해 일시적인 결합을 추구한다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Some seek temporary unity through intoxication or intense excitement.
어떤 사람들은 술이나 강렬한 흥분을 통해 일시적인 결합을 추구한다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 026
튜플로 고정 자료 묶기
Others escape loneliness by conforming completely to the group.
또 다른 사람들은 집단에 완전히 순응함으로써 외로움에서 벗어나려 한다.
파이썬 코드
sentence_pair = ('Others escape loneliness by conforming completely to the group.', '또 다른 사람들은 집단에 완전히 순응함으로써 외로움에서 벗어나려 한다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
Others escape loneliness by conforming completely to the group.
또 다른 사람들은 집단에 완전히 순응함으로써 외로움에서 벗어나려 한다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 027
딕셔너리의 키와 값
Conformity reduces visible difference but does not create deep intimacy.
순응은 겉으로 드러나는 차이를 줄이지만 깊은 친밀감을 만들지는 못한다.
파이썬 코드
sentence = {
"number": 27,
"english": 'Conformity reduces visible difference but does not create deep intimacy.',
"korean": '순응은 겉으로 드러나는 차이를 줄이지만 깊은 친밀감을 만들지는 못한다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
27
Conformity reduces visible difference but does not create deep intimacy.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 028
집합으로 핵심 단어 중복 제거
Creative work can also connect a person with the world in a meaningful way.
Yet work alone cannot fully satisfy the need for interpersonal union.
그러나 노동만으로는 인간관계 속 결합의 욕구를 완전히 충족할 수 없다.
파이썬 코드
sentences = ['Yet work alone cannot fully satisfy the need for interpersonal union.', '그러나 노동만으로는 인간관계 속 결합의 욕구를 완전히 충족할 수 없다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Yet work alone cannot fully satisfy the need for interpersonal union.
그러나 노동만으로는 인간관계 속 결합의 욕구를 완전히 충족할 수 없다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 030
튜플로 고정 자료 묶기
Mature love is Fromm's most complete answer to human separateness.
성숙한 사랑은 인간의 분리 상태에 대한 프롬의 가장 완전한 해답이다.
파이썬 코드
sentence_pair = ("Mature love is Fromm's most complete answer to human separateness.", '성숙한 사랑은 인간의 분리 상태에 대한 프롬의 가장 완전한 해답이다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
Mature love is Fromm's most complete answer to human separateness.
성숙한 사랑은 인간의 분리 상태에 대한 프롬의 가장 완전한 해답이다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 031
딕셔너리의 키와 값
It unites people without demanding the destruction of the self.
그것은 자아의 파괴를 요구하지 않으면서 사람들을 결합한다.
파이썬 코드
sentence = {
"number": 31,
"english": 'It unites people without demanding the destruction of the self.',
"korean": '그것은 자아의 파괴를 요구하지 않으면서 사람들을 결합한다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
31
It unites people without demanding the destruction of the self.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 032
집합으로 핵심 단어 중복 제거
Immature forms of union often involve submission or control.
A submissive person tries to escape isolation by becoming part of someone stronger.
복종적인 사람은 더 강한 사람의 일부가 되어 고립에서 벗어나려 한다.
파이썬 코드
sentences = ['A submissive person tries to escape isolation by becoming part of someone stronger.', '복종적인 사람은 더 강한 사람의 일부가 되어 고립에서 벗어나려 한다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
A submissive person tries to escape isolation by becoming part of someone stronger.
복종적인 사람은 더 강한 사람의 일부가 되어 고립에서 벗어나려 한다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 034
튜플로 고정 자료 묶기
A dominating person tries to escape isolation by absorbing another person.
지배적인 사람은 다른 사람을 자기 안에 흡수함으로써 고립을 피하려 한다.
파이썬 코드
sentence_pair = ('A dominating person tries to escape isolation by absorbing another person.', '지배적인 사람은 다른 사람을 자기 안에 흡수함으로써 고립을 피하려 한다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
A dominating person tries to escape isolation by absorbing another person.
지배적인 사람은 다른 사람을 자기 안에 흡수함으로써 고립을 피하려 한다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 035
딕셔너리의 키와 값
Both patterns create dependency rather than genuine partnership.
두 방식 모두 진정한 동반자 관계가 아니라 의존을 만든다.
파이썬 코드
sentence = {
"number": 35,
"english": 'Both patterns create dependency rather than genuine partnership.',
"korean": '두 방식 모두 진정한 동반자 관계가 아니라 의존을 만든다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
35
Both patterns create dependency rather than genuine partnership.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 036
집합으로 핵심 단어 중복 제거
Mature union requires two people who can stand on their own.
Their closeness grows from freedom rather than fear.
그들의 친밀함은 두려움이 아니라 자유에서 자란다.
파이썬 코드
sentences = ['Their closeness grows from freedom rather than fear.', '그들의 친밀함은 두려움이 아니라 자유에서 자란다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Their closeness grows from freedom rather than fear.
그들의 친밀함은 두려움이 아니라 자유에서 자란다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 038
튜플로 고정 자료 묶기
Love becomes healthy when it answers loneliness without denying individuality.
사랑은 개성을 부정하지 않으면서 외로움에 답할 때 건강해진다.
파이썬 코드
sentence_pair = ('Love becomes healthy when it answers loneliness without denying individuality.', '사랑은 개성을 부정하지 않으면서 외로움에 답할 때 건강해진다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
Love becomes healthy when it answers loneliness without denying individuality.
사랑은 개성을 부정하지 않으면서 외로움에 답할 때 건강해진다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 039
딕셔너리의 키와 값
The desire for union is universal, but its expression can be constructive or destructive.
결합을 향한 욕구는 보편적이지만 그 표현은 건설적일 수도 파괴적일 수도 있다.
파이썬 코드
sentence = {
"number": 39,
"english": 'The desire for union is universal, but its expression can be constructive or destructive.',
"korean": '결합을 향한 욕구는 보편적이지만 그 표현은 건설적일 수도 파괴적일 수도 있다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
39
The desire for union is universal, but its expression can be constructive or destructive.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 040
집합으로 핵심 단어 중복 제거
Fromm therefore evaluates love by the quality of the relationship it creates.
Fromm identifies care as one of the basic elements of love.
프롬은 돌봄을 사랑의 기본 요소 가운데 하나로 본다.
파이썬 코드
sentences = ['Fromm identifies care as one of the basic elements of love.', '프롬은 돌봄을 사랑의 기본 요소 가운데 하나로 본다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Fromm identifies care as one of the basic elements of love.
프롬은 돌봄을 사랑의 기본 요소 가운데 하나로 본다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 042
튜플로 고정 자료 묶기
Care means active concern for the life and growth of the loved person.
돌봄은 사랑하는 사람의 삶과 성장에 능동적인 관심을 기울이는 것이다.
파이썬 코드
sentence_pair = ('Care means active concern for the life and growth of the loved person.', '돌봄은 사랑하는 사람의 삶과 성장에 능동적인 관심을 기울이는 것이다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
Care means active concern for the life and growth of the loved person.
돌봄은 사랑하는 사람의 삶과 성장에 능동적인 관심을 기울이는 것이다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 043
딕셔너리의 키와 값
A claim of love without care is empty.
돌봄이 없는 사랑의 주장은 공허하다.
파이썬 코드
sentence = {
"number": 43,
"english": 'A claim of love without care is empty.',
"korean": '돌봄이 없는 사랑의 주장은 공허하다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
43
A claim of love without care is empty.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
Responsibility means responding willingly to another person's expressed and unexpressed needs.
책임은 다른 사람의 드러난 필요와 드러나지 않은 필요에 자발적으로 응답하는 것이다.
파이썬 코드
sentences = ["Responsibility means responding willingly to another person's expressed and unexpressed needs.", '책임은 다른 사람의 드러난 필요와 드러나지 않은 필요에 자발적으로 응답하는 것이다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Responsibility means responding willingly to another person's expressed and unexpressed needs.
책임은 다른 사람의 드러난 필요와 드러나지 않은 필요에 자발적으로 응답하는 것이다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 046
튜플로 고정 자료 묶기
It should not be confused with control or imposed duty.
책임을 통제나 강요된 의무와 혼동해서는 안 된다.
파이썬 코드
sentence_pair = ('It should not be confused with control or imposed duty.', '책임을 통제나 강요된 의무와 혼동해서는 안 된다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
It should not be confused with control or imposed duty.
책임을 통제나 강요된 의무와 혼동해서는 안 된다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
예제 047
딕셔너리의 키와 값
Respect protects responsibility from becoming domination.
존중은 책임이 지배로 변하지 않도록 막아 준다.
파이썬 코드
sentence = {
"number": 47,
"english": 'Respect protects responsibility from becoming domination.',
"korean": '존중은 책임이 지배로 변하지 않도록 막아 준다.'
}
print(sentence["number"])
print(sentence["english"])
예상 실행 결과
47
Respect protects responsibility from becoming domination.
문법 설명
딕셔너리에 번호, 영어, 한글을 키-값 구조로 저장하고 키를 이용해 원하는 값을 조회합니다.
예제 048
집합으로 핵심 단어 중복 제거
To respect someone is to see that person as a unique individual.
Respect allows the other person to grow in their own way.
존중은 상대방이 자기 방식으로 성장하도록 허용한다.
파이썬 코드
sentences = ['Respect allows the other person to grow in their own way.', '존중은 상대방이 자기 방식으로 성장하도록 허용한다.']
print(sentences[0])
print(sentences[1])
예상 실행 결과
Respect allows the other person to grow in their own way.
존중은 상대방이 자기 방식으로 성장하도록 허용한다.
문법 설명
대괄호로 리스트를 만들고, 0번과 1번 인덱스로 영어 문장과 한글 번역을 꺼냅니다.
예제 050
튜플로 고정 자료 묶기
A person who needs to possess another cannot truly respect them.
다른 사람을 소유해야만 하는 사람은 그를 진정으로 존중할 수 없다.
파이썬 코드
sentence_pair = ('A person who needs to possess another cannot truly respect them.', '다른 사람을 소유해야만 하는 사람은 그를 진정으로 존중할 수 없다.')
english, korean = sentence_pair
print(english)
print(korean)
예상 실행 결과
A person who needs to possess another cannot truly respect them.
다른 사람을 소유해야만 하는 사람은 그를 진정으로 존중할 수 없다.
문법 설명
변경하지 않을 영어·한글 문장 쌍을 튜플로 저장하고 언패킹하여 두 변수에 나눕니다.
02
조건문 · 반복문 · 제어문
문장 길이와 단어를 조건에 따라 판단하고 반복 처리합니다.
예제 051
if 조건문으로 문장 길이 분류
Knowledge is the fourth major element of love.
지식은 사랑의 네 번째 주요 요소이다.
파이썬 코드
text = 'Knowledge is the fourth major element of love.'
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 052
if·elif·else 다중 조건
Loving knowledge goes beyond collecting facts about someone.
사랑에 필요한 앎은 누군가에 대한 사실을 모으는 것을 넘어선다.
파이썬 코드
word_count = len('Loving knowledge goes beyond collecting facts about someone.'.split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
8 brief
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 053
for 반복문으로 단어 출력
It involves understanding the deeper feelings and needs behind behavior.
그것은 행동 뒤에 있는 깊은 감정과 욕구를 이해하는 일을 포함한다.
파이썬 코드
words = ['It', 'involves', 'understanding', 'the', 'deeper']
for word in words:
print(word)
예상 실행 결과
It
involves
understanding
the
deeper
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 054
while 반복문으로 문장 쌍 순회
Such knowledge requires empathy and patient attention.
그러한 앎에는 공감과 인내심 있는 관심이 필요하다.
파이썬 코드
items = ['Such knowledge requires empathy and patient attention.', '그러한 앎에는 공감과 인내심 있는 관심이 필요하다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 Such knowledge requires empathy and patient attention.
2 그러한 앎에는 공감과 인내심 있는 관심이 필요하다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 055
break와 continue 제어문
Care, responsibility, respect, and knowledge support one another.
돌봄, 책임, 존중, 앎은 서로를 지지한다.
파이썬 코드
words = ['Care,', 'responsibility,', 'respect,', 'and', 'knowledge', 'support', 'one', 'another.']
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['Care,', 'responsibility,', 'respect,']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
예제 056
if 조건문으로 문장 길이 분류
Care without respect may become possessive.
존중 없는 돌봄은 소유욕으로 변할 수 있다.
파이썬 코드
text = 'Care without respect may become possessive.'
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 057
if·elif·else 다중 조건
Responsibility without knowledge may become misguided interference.
앎 없는 책임은 잘못된 간섭이 될 수 있다.
파이썬 코드
word_count = len('Responsibility without knowledge may become misguided interference.'.split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
7 brief
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 058
for 반복문으로 단어 출력
Knowledge without care may remain cold and detached.
돌봄 없는 앎은 차갑고 무관심한 상태로 남을 수 있다.
파이썬 코드
words = ['Knowledge', 'without', 'care', 'may', 'remain']
for word in words:
print(word)
예상 실행 결과
Knowledge
without
care
may
remain
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 059
while 반복문으로 문장 쌍 순회
Mature love combines all four elements in a balanced way.
성숙한 사랑은 이 네 요소를 균형 있게 결합한다.
파이썬 코드
items = ['Mature love combines all four elements in a balanced way.', '성숙한 사랑은 이 네 요소를 균형 있게 결합한다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 Mature love combines all four elements in a balanced way.
2 성숙한 사랑은 이 네 요소를 균형 있게 결합한다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 060
break와 continue 제어문
These elements apply to many forms of love, not only romantic love.
이 요소들은 낭만적 사랑뿐 아니라 여러 형태의 사랑에 적용된다.
파이썬 코드
words = ['These', 'elements', 'apply', 'to', 'many', 'forms', 'of', 'love,', 'not', 'only']
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['These', 'elements', 'apply']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
예제 061
if 조건문으로 문장 길이 분류
Brotherly love is the most fundamental form of love in Fromm's account.
프롬의 설명에서 형제애는 가장 기본적인 사랑의 형태이다.
파이썬 코드
text = "Brotherly love is the most fundamental form of love in Fromm's account."
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 062
if·elif·else 다중 조건
It is based on a sense of solidarity with all human beings.
형제애는 모든 인간과 연대한다는 감각에 바탕을 둔다.
파이썬 코드
word_count = len('It is based on a sense of solidarity with all human beings.'.split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
12 medium
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 063
for 반복문으로 단어 출력
Brotherly love recognizes that people share common needs and vulnerabilities.
형제애는 사람들이 공통된 필요와 취약성을 지닌다는 사실을 인정한다.
파이썬 코드
words = ['Brotherly', 'love', 'recognizes', 'that', 'people']
for word in words:
print(word)
예상 실행 결과
Brotherly
love
recognizes
that
people
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 064
while 반복문으로 문장 쌍 순회
It does not depend on social rank, success, or usefulness.
형제애는 사회적 지위나 성공, 유용성에 의존하지 않는다.
파이썬 코드
items = ['It does not depend on social rank, success, or usefulness.', '형제애는 사회적 지위나 성공, 유용성에 의존하지 않는다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 It does not depend on social rank, success, or usefulness.
2 형제애는 사회적 지위나 성공, 유용성에 의존하지 않는다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 065
break와 continue 제어문
Motherly love affirms both the child's life and the child's growth.
모성애는 아이의 생명과 성장을 모두 긍정한다.
파이썬 코드
words = ['Motherly', 'love', 'affirms', 'both', 'the', "child's", 'life', 'and', 'the', "child's"]
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['Motherly', 'love', 'affirms']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
예제 066
if 조건문으로 문장 길이 분류
It gives protection, warmth, and a sense that life is worth living.
모성애는 보호와 따뜻함, 삶이 살아갈 가치가 있다는 느낌을 준다.
파이썬 코드
text = 'It gives protection, warmth, and a sense that life is worth living.'
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 067
if·elif·else 다중 조건
Healthy motherly love also supports the child's eventual independence.
건강한 모성애는 아이가 결국 독립하도록 돕는다.
파이썬 코드
word_count = len("Healthy motherly love also supports the child's eventual independence.".split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
9 brief
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 068
for 반복문으로 단어 출력
A parent must be able to love the child while allowing separation.
부모는 아이를 사랑하면서도 분리를 허용할 수 있어야 한다.
파이썬 코드
words = ['A', 'parent', 'must', 'be', 'able']
for word in words:
print(word)
예상 실행 결과
A
parent
must
be
able
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 069
while 반복문으로 문장 쌍 순회
Erotic love seeks complete union with one particular person.
성애는 한 특정한 사람과 완전히 결합하기를 추구한다.
파이썬 코드
items = ['Erotic love seeks complete union with one particular person.', '성애는 한 특정한 사람과 완전히 결합하기를 추구한다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 Erotic love seeks complete union with one particular person.
2 성애는 한 특정한 사람과 완전히 결합하기를 추구한다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 070
break와 continue 제어문
Its exclusiveness can make it seem different from universal love.
그 배타성 때문에 성애는 보편적 사랑과 다른 것처럼 보일 수 있다.
파이썬 코드
words = ['Its', 'exclusiveness', 'can', 'make', 'it', 'seem', 'different', 'from', 'universal', 'love.']
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['exclusiveness', 'make', 'seem']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
예제 071
if 조건문으로 문장 길이 분류
Fromm warns that intense attraction alone is not proof of mature love.
프롬은 강렬한 끌림만으로는 성숙한 사랑의 증거가 되지 않는다고 경고한다.
파이썬 코드
text = 'Fromm warns that intense attraction alone is not proof of mature love.'
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 072
if·elif·else 다중 조건
Sudden intimacy can be mistaken for lasting depth.
갑작스러운 친밀감은 지속적인 깊이로 오해될 수 있다.
파이썬 코드
word_count = len('Sudden intimacy can be mistaken for lasting depth.'.split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
8 brief
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 073
for 반복문으로 단어 출력
Sexual desire may create a temporary sense of union.
성적 욕망은 일시적인 결합감을 만들 수 있다.
파이썬 코드
words = ['Sexual', 'desire', 'may', 'create', 'a']
for word in words:
print(word)
예상 실행 결과
Sexual
desire
may
create
a
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 074
while 반복문으로 문장 쌍 순회
Without care and respect, that union quickly becomes shallow.
돌봄과 존중이 없으면 그 결합은 곧 피상적으로 변한다.
파이썬 코드
items = ['Without care and respect, that union quickly becomes shallow.', '돌봄과 존중이 없으면 그 결합은 곧 피상적으로 변한다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 Without care and respect, that union quickly becomes shallow.
2 돌봄과 존중이 없으면 그 결합은 곧 피상적으로 변한다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 075
break와 continue 제어문
Mature erotic love includes a deliberate commitment to one person.
성숙한 성애에는 한 사람을 향한 의식적인 헌신이 포함된다.
파이썬 코드
words = ['Mature', 'erotic', 'love', 'includes', 'a', 'deliberate', 'commitment', 'to', 'one', 'person.']
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['Mature', 'erotic', 'love']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
예제 076
if 조건문으로 문장 길이 분류
This commitment is more than a changing mood.
이 헌신은 변하기 쉬운 기분 이상의 것이다.
파이썬 코드
text = 'This commitment is more than a changing mood.'
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 077
if·elif·else 다중 조건
It is a decision to share life while honoring the partner's freedom.
그것은 상대의 자유를 존중하면서 삶을 함께 나누겠다는 결정이다.
파이썬 코드
word_count = len("It is a decision to share life while honoring the partner's freedom.".split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
12 medium
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 078
for 반복문으로 단어 출력
Exclusive love should not require indifference toward the rest of humanity.
배타적 사랑이 나머지 인류에 대한 무관심을 요구해서는 안 된다.
파이썬 코드
words = ['Exclusive', 'love', 'should', 'not', 'require']
for word in words:
print(word)
예상 실행 결과
Exclusive
love
should
not
require
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 079
while 반복문으로 문장 쌍 순회
A person capable of mature erotic love must also possess a broader capacity for love.
성숙한 성애가 가능한 사람은 더 넓은 사랑의 능력도 지녀야 한다.
파이썬 코드
items = ['A person capable of mature erotic love must also possess a broader capacity for love.', '성숙한 성애가 가능한 사람은 더 넓은 사랑의 능력도 지녀야 한다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 A person capable of mature erotic love must also possess a broader capacity for love.
2 성숙한 성애가 가능한 사람은 더 넓은 사랑의 능력도 지녀야 한다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 080
break와 continue 제어문
Particular love becomes healthier when it grows from a loving orientation toward life.
특정한 사람을 향한 사랑은 삶 전체를 사랑하는 태도에서 자랄 때 더 건강해진다.
파이썬 코드
words = ['Particular', 'love', 'becomes', 'healthier', 'when', 'it', 'grows', 'from', 'a', 'loving']
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['Particular', 'love', 'becomes']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
예제 081
if 조건문으로 문장 길이 분류
Fromm rejects the idea that self-love is necessarily selfish.
프롬은 자기 사랑이 반드시 이기적이라는 생각을 거부한다.
파이썬 코드
text = 'Fromm rejects the idea that self-love is necessarily selfish.'
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 082
if·elif·else 다중 조건
He argues that love for oneself and love for others are connected.
그는 자신에 대한 사랑과 다른 사람에 대한 사랑이 서로 연결되어 있다고 주장한다.
파이썬 코드
word_count = len('He argues that love for oneself and love for others are connected.'.split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
12 medium
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 083
for 반복문으로 단어 출력
A person who respects human life should also respect their own life.
인간의 생명을 존중하는 사람은 자신의 생명도 존중해야 한다.
파이썬 코드
words = ['A', 'person', 'who', 'respects', 'human']
for word in words:
print(word)
예상 실행 결과
A
person
who
respects
human
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 084
while 반복문으로 문장 쌍 순회
Self-love includes care, responsibility, respect, and knowledge directed toward oneself.
자기 사랑은 자신을 향한 돌봄, 책임, 존중, 앎을 포함한다.
파이썬 코드
items = ['Self-love includes care, responsibility, respect, and knowledge directed toward oneself.', '자기 사랑은 자신을 향한 돌봄, 책임, 존중, 앎을 포함한다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 Self-love includes care, responsibility, respect, and knowledge directed toward oneself.
2 자기 사랑은 자신을 향한 돌봄, 책임, 존중, 앎을 포함한다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 085
break와 continue 제어문
Selfishness is different because it is driven by inner emptiness.
이기심은 내면의 공허함에서 비롯된다는 점에서 자기 사랑과 다르다.
파이썬 코드
words = ['Selfishness', 'is', 'different', 'because', 'it', 'is', 'driven', 'by', 'inner', 'emptiness.']
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['Selfishness', 'different', 'because']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
예제 086
if 조건문으로 문장 길이 분류
The selfish person constantly takes but is rarely satisfied.
이기적인 사람은 끊임없이 취하지만 좀처럼 만족하지 못한다.
파이썬 코드
text = 'The selfish person constantly takes but is rarely satisfied.'
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 087
if·elif·else 다중 조건
Healthy self-love makes generous love of others more possible.
건강한 자기 사랑은 다른 사람을 너그럽게 사랑하는 일을 더 가능하게 한다.
파이썬 코드
word_count = len('Healthy self-love makes generous love of others more possible.'.split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
9 brief
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 088
for 반복문으로 단어 출력
Self-contempt often leads to dependence, resentment, or hidden demands.
자기 멸시는 흔히 의존, 원망, 숨은 요구로 이어진다.
파이썬 코드
words = ['Self-contempt', 'often', 'leads', 'to', 'dependence,']
for word in words:
print(word)
예상 실행 결과
Self-contempt
often
leads
to
dependence,
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 089
while 반복문으로 문장 쌍 순회
Fromm also discusses the love of God as a human response to existence.
프롬은 신에 대한 사랑도 인간이 존재에 응답하는 방식으로 논의한다.
파이썬 코드
items = ['Fromm also discusses the love of God as a human response to existence.', '프롬은 신에 대한 사랑도 인간이 존재에 응답하는 방식으로 논의한다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 Fromm also discusses the love of God as a human response to existence.
2 프롬은 신에 대한 사랑도 인간이 존재에 응답하는 방식으로 논의한다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 090
break와 continue 제어문
Different religious traditions express different ideas of divine love.
서로 다른 종교 전통은 신적 사랑에 관한 서로 다른 관념을 표현한다.
파이썬 코드
words = ['Different', 'religious', 'traditions', 'express', 'different', 'ideas', 'of', 'divine', 'love.']
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['Different', 'religious', 'traditions']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
예제 091
if 조건문으로 문장 길이 분류
In authoritarian religion, God may be imagined as a powerful ruler.
권위주의적 종교에서 신은 강력한 지배자로 상상될 수 있다.
파이썬 코드
text = 'In authoritarian religion, God may be imagined as a powerful ruler.'
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 092
if·elif·else 다중 조건
The believer then seeks protection through obedience and submission.
그때 신자는 복종과 순종을 통해 보호를 얻으려 한다.
파이썬 코드
word_count = len('The believer then seeks protection through obedience and submission.'.split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
9 brief
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 093
for 반복문으로 단어 출력
In a more mature religious orientation, God symbolizes truth, justice, and love.
더 성숙한 종교적 태도에서 신은 진리, 정의, 사랑을 상징한다.
파이썬 코드
words = ['In', 'a', 'more', 'mature', 'religious']
for word in words:
print(word)
예상 실행 결과
In
a
more
mature
religious
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 094
while 반복문으로 문장 쌍 순회
The goal is not merely to obey but to develop godlike qualities within oneself.
목표는 단순히 복종하는 것이 아니라 자기 안에서 신적인 성품을 기르는 것이다.
파이썬 코드
items = ['The goal is not merely to obey but to develop godlike qualities within oneself.', '목표는 단순히 복종하는 것이 아니라 자기 안에서 신적인 성품을 기르는 것이다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 The goal is not merely to obey but to develop godlike qualities within oneself.
2 목표는 단순히 복종하는 것이 아니라 자기 안에서 신적인 성품을 기르는 것이다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 095
break와 continue 제어문
Fromm compares father-centered and mother-centered images of divine love.
프롬은 아버지 중심의 신적 사랑과 어머니 중심의 신적 사랑을 비교한다.
파이썬 코드
words = ['Fromm', 'compares', 'father-centered', 'and', 'mother-centered', 'images', 'of', 'divine', 'love.']
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['Fromm', 'compares', 'father-centered']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
예제 096
if 조건문으로 문장 길이 분류
The fatherly image emphasizes law, guidance, and standards.
아버지적 이미지는 법, 인도, 기준을 강조한다.
파이썬 코드
text = 'The fatherly image emphasizes law, guidance, and standards.'
if len(text) >= 80:
level = "long"
else:
level = "short"
print(level)
예상 실행 결과
short
문법 설명
문자열 길이가 80자 이상인지 판단하여 긴 문장과 짧은 문장으로 분류합니다.
예제 097
if·elif·else 다중 조건
The motherly image emphasizes unconditional affirmation and mercy.
어머니적 이미지는 무조건적인 긍정과 자비를 강조한다.
파이썬 코드
word_count = len('The motherly image emphasizes unconditional affirmation and mercy.'.split())
if word_count < 10:
result = "brief"
elif word_count < 16:
result = "medium"
else:
result = "detailed"
print(word_count, result)
예상 실행 결과
8 brief
문법 설명
단어 수에 따라 세 구간으로 나누는 다중 조건문을 연습합니다.
예제 098
for 반복문으로 단어 출력
Mature faith seeks to integrate justice with compassion.
성숙한 신앙은 정의와 연민을 통합하려 한다.
파이썬 코드
words = ['Mature', 'faith', 'seeks', 'to', 'integrate']
for word in words:
print(word)
예상 실행 결과
Mature
faith
seeks
to
integrate
문법 설명
리스트의 단어를 for 반복문으로 하나씩 순회하여 출력합니다.
예제 099
while 반복문으로 문장 쌍 순회
Love of God reflects the person's general capacity for love.
신에 대한 사랑은 그 사람의 전반적인 사랑의 능력을 반영한다.
파이썬 코드
items = ["Love of God reflects the person's general capacity for love.", '신에 대한 사랑은 그 사람의 전반적인 사랑의 능력을 반영한다.']
index = 0
while index < len(items):
print(index + 1, items[index])
index += 1
예상 실행 결과
1 Love of God reflects the person's general capacity for love.
2 신에 대한 사랑은 그 사람의 전반적인 사랑의 능력을 반영한다.
문법 설명
인덱스를 직접 증가시키며 영어 문장과 번역을 차례대로 출력합니다.
예제 100
break와 continue 제어문
For Fromm, religious language is meaningful when it deepens responsible and loving living.
프롬에게 종교적 언어는 책임 있고 사랑하는 삶을 깊게 할 때 의미가 있다.
파이썬 코드
words = ['For', 'Fromm,', 'religious', 'language', 'is', 'meaningful', 'when', 'it', 'deepens', 'responsible']
selected = []
for word in words:
if len(word) <= 3:
continue
selected.append(word)
if len(selected) == 3:
break
print(selected)
예상 실행 결과
['Fromm,', 'religious', 'language']
문법 설명
짧은 단어는 continue로 건너뛰고, 세 단어를 모으면 break로 반복을 끝냅니다.
03
함수 · 람다 · 내장 함수
반복 작업을 함수로 만들고 파이썬 내장 기능을 활용합니다.
예제 101
매개변수와 반환값
Fromm believes that modern social conditions often weaken the capacity to love.
프롬은 현대 사회의 조건이 사랑할 수 있는 능력을 약화시키는 경우가 많다고 본다.
파이썬 코드
def sentence_length(text):
return len(text)
english = 'Fromm believes that modern social conditions often weaken the capacity to love.'
print(sentence_length(english))
예상 실행 결과
79
문법 설명
문자열을 매개변수로 받고 글자 수를 반환하는 함수를 정의합니다.
예제 102
기본값 매개변수
Market values influence how people view themselves and one another.
시장 가치는 사람들이 자신과 타인을 바라보는 방식에 영향을 준다.
파이썬 코드
def show_sentence(text, label="LOVE"):
return f"[{label}] {text}"
print(show_sentence('Market values influence how people view themselves and one another.'))
예상 실행 결과
[LOVE] Market values influence how people view themselves and one another.
문법 설명
label에 기본값을 지정하여 인수를 생략해도 함수가 실행되도록 합니다.
예제 103
람다로 단어 길이 정렬
Individuals may present their personality as if it were a product for sale.
개인은 자신의 성격을 판매할 상품처럼 내보일 수 있다.
파이썬 코드
words = ['Individuals', 'may', 'present', 'their', 'personality', 'as', 'if']
result = sorted(words, key=lambda word: len(word))
print(result)
Romantic relationships can then resemble exchanges between desirable packages.
그 결과 연애 관계는 매력적인 상품 묶음 사이의 교환처럼 보일 수 있다.
파이썬 코드
english = 'Romantic relationships can then resemble exchanges between desirable packages.'.split()[:3]
korean = '그 결과 연애 관계는 매력적인 상품 묶음 사이의 교환처럼 보일 수 있다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
People ask whether they are getting a fair bargain in love.
사람들은 사랑에서 자신이 공정한 거래를 하고 있는지 묻는다.
파이썬 코드
def sentence_length(text):
return len(text)
english = 'People ask whether they are getting a fair bargain in love.'
print(sentence_length(english))
예상 실행 결과
59
문법 설명
문자열을 매개변수로 받고 글자 수를 반환하는 함수를 정의합니다.
예제 107
기본값 매개변수
This market orientation encourages calculation rather than deep commitment.
이러한 시장 지향성은 깊은 헌신보다 계산을 부추긴다.
파이썬 코드
def show_sentence(text, label="LOVE"):
return f"[{label}] {text}"
print(show_sentence('This market orientation encourages calculation rather than deep commitment.'))
예상 실행 결과
[LOVE] This market orientation encourages calculation rather than deep commitment.
문법 설명
label에 기본값을 지정하여 인수를 생략해도 함수가 실행되도록 합니다.
예제 108
람다로 단어 길이 정렬
Modern life also promotes speed, distraction, and constant consumption.
현대 생활은 속도와 산만함, 끊임없는 소비도 촉진한다.
파이썬 코드
words = ['Modern', 'life', 'also', 'promotes', 'speed,', 'distraction,', 'and']
result = sorted(words, key=lambda word: len(word))
print(result)
Many people confuse excitement with aliveness and possession with security.
많은 사람은 흥분을 생동감으로, 소유를 안정감으로 혼동한다.
파이썬 코드
english = 'Many people confuse excitement with aliveness and possession with security.'.split()[:3]
korean = '많은 사람은 흥분을 생동감으로, 소유를 안정감으로 혼동한다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
They may use relationships to escape boredom rather than to grow.
그들은 성장하기보다 지루함을 피하기 위해 관계를 이용할 수 있다.
파이썬 코드
def sentence_length(text):
return len(text)
english = 'They may use relationships to escape boredom rather than to grow.'
print(sentence_length(english))
예상 실행 결과
65
문법 설명
문자열을 매개변수로 받고 글자 수를 반환하는 함수를 정의합니다.
예제 112
기본값 매개변수
Popular culture often portrays love as effortless compatibility.
대중문화는 흔히 사랑을 노력 없는 궁합으로 묘사한다.
파이썬 코드
def show_sentence(text, label="LOVE"):
return f"[{label}] {text}"
print(show_sentence('Popular culture often portrays love as effortless compatibility.'))
예상 실행 결과
[LOVE] Popular culture often portrays love as effortless compatibility.
문법 설명
label에 기본값을 지정하여 인수를 생략해도 함수가 실행되도록 합니다.
예제 113
람다로 단어 길이 정렬
Fromm argues that conflict does not always mean love has failed.
프롬은 갈등이 항상 사랑의 실패를 뜻하지는 않는다고 주장한다.
파이썬 코드
words = ['Fromm', 'argues', 'that', 'conflict', 'does', 'not', 'always']
result = sorted(words, key=lambda word: len(word))
print(result)
Superficial harmony may hide distance, fear, or indifference.
피상적인 조화는 거리감과 두려움, 무관심을 숨길 수 있다.
파이썬 코드
english = 'Superficial harmony may hide distance, fear, or indifference.'.split()[:3]
korean = '피상적인 조화는 거리감과 두려움, 무관심을 숨길 수 있다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
Modern couples sometimes become a team organized mainly for comfort and success.
현대의 부부는 때때로 편안함과 성공을 위해 조직된 팀이 되기도 한다.
파이썬 코드
def sentence_length(text):
return len(text)
english = 'Modern couples sometimes become a team organized mainly for comfort and success.'
print(sentence_length(english))
예상 실행 결과
80
문법 설명
문자열을 매개변수로 받고 글자 수를 반환하는 함수를 정의합니다.
예제 117
기본값 매개변수
Such cooperation can function well while emotional depth remains limited.
그러한 협력은 잘 작동할 수 있지만 정서적 깊이는 제한될 수 있다.
파이썬 코드
def show_sentence(text, label="LOVE"):
return f"[{label}] {text}"
print(show_sentence('Such cooperation can function well while emotional depth remains limited.'))
예상 실행 결과
[LOVE] Such cooperation can function well while emotional depth remains limited.
문법 설명
label에 기본값을 지정하여 인수를 생략해도 함수가 실행되도록 합니다.
예제 118
람다로 단어 길이 정렬
Fromm criticizes relationships that reduce love to mutual satisfaction.
프롬은 사랑을 상호 만족으로 축소하는 관계를 비판한다.
파이썬 코드
words = ['Fromm', 'criticizes', 'relationships', 'that', 'reduce', 'love', 'to']
result = sorted(words, key=lambda word: len(word))
print(result)
The health of love is therefore connected with the health of society.
따라서 사랑의 건강성은 사회의 건강성과 연결된다.
파이썬 코드
english = 'The health of love is therefore connected with the health of society.'.split()[:3]
korean = '따라서 사랑의 건강성은 사회의 건강성과 연결된다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
One common illusion is that falling in love is the same as standing in love.
흔한 착각 가운데 하나는 사랑에 빠지는 것과 사랑을 지속하는 것이 같다는 생각이다.
파이썬 코드
def sentence_length(text):
return len(text)
english = 'One common illusion is that falling in love is the same as standing in love.'
print(sentence_length(english))
예상 실행 결과
76
문법 설명
문자열을 매개변수로 받고 글자 수를 반환하는 함수를 정의합니다.
예제 122
기본값 매개변수
The first experience of closeness can feel powerful because previous distance suddenly disappears.
처음 느끼는 친밀감은 이전의 거리가 갑자기 사라지기 때문에 강렬하게 느껴질 수 있다.
파이썬 코드
def show_sentence(text, label="LOVE"):
return f"[{label}] {text}"
print(show_sentence('The first experience of closeness can feel powerful because previous distance suddenly disappears.'))
예상 실행 결과
[LOVE] The first experience of closeness can feel powerful because previous distance suddenly disappears.
문법 설명
label에 기본값을 지정하여 인수를 생략해도 함수가 실행되도록 합니다.
예제 123
람다로 단어 길이 정렬
As familiarity grows, the original excitement naturally changes.
익숙함이 커지면 처음의 흥분은 자연스럽게 달라진다.
파이썬 코드
words = ['As', 'familiarity', 'grows,', 'the', 'original', 'excitement', 'naturally']
result = sorted(words, key=lambda word: len(word))
print(result)
They then search for a new person to recreate the initial thrill.
그러면 처음의 설렘을 다시 만들기 위해 새로운 사람을 찾는다.
파이썬 코드
english = 'They then search for a new person to recreate the initial thrill.'.split()[:3]
korean = '그러면 처음의 설렘을 다시 만들기 위해 새로운 사람을 찾는다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
This cycle prevents the development of deeper intimacy.
이 순환은 더 깊은 친밀감의 발달을 막는다.
파이썬 코드
def sentence_length(text):
return len(text)
english = 'This cycle prevents the development of deeper intimacy.'
print(sentence_length(english))
예상 실행 결과
55
문법 설명
문자열을 매개변수로 받고 글자 수를 반환하는 함수를 정의합니다.
예제 127
기본값 매개변수
Another illusion is that perfect communication will remove every difficulty.
또 다른 착각은 완벽한 의사소통이 모든 어려움을 없앨 것이라는 생각이다.
파이썬 코드
def show_sentence(text, label="LOVE"):
return f"[{label}] {text}"
print(show_sentence('Another illusion is that perfect communication will remove every difficulty.'))
예상 실행 결과
[LOVE] Another illusion is that perfect communication will remove every difficulty.
문법 설명
label에 기본값을 지정하여 인수를 생략해도 함수가 실행되도록 합니다.
예제 128
람다로 단어 길이 정렬
Communication helps, but love also requires character and courage.
의사소통은 도움이 되지만 사랑에는 인격과 용기도 필요하다.
파이썬 코드
words = ['Communication', 'helps,', 'but', 'love', 'also', 'requires', 'character']
result = sorted(words, key=lambda word: len(word))
print(result)
Mutual blame can create activity without genuine change.
서로를 비난하면 겉으로는 움직임이 생기지만 진정한 변화는 일어나지 않을 수 있다.
파이썬 코드
english = 'Mutual blame can create activity without genuine change.'.split()[:3]
korean = '서로를 비난하면 겉으로는 움직임이 생기지만 진정한 변화는 일어나지 않을 수 있다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
Sentimental love is another substitute for direct relationship.
감상적인 사랑은 직접적인 관계를 대신하는 또 하나의 대체물이다.
파이썬 코드
def sentence_length(text):
return len(text)
english = 'Sentimental love is another substitute for direct relationship.'
print(sentence_length(english))
예상 실행 결과
63
문법 설명
문자열을 매개변수로 받고 글자 수를 반환하는 함수를 정의합니다.
예제 132
기본값 매개변수
A person may feel deeply moved by fictional love while remaining emotionally distant in real life.
사람은 허구의 사랑에는 깊이 감동하면서 실제 삶에서는 정서적으로 멀리 있을 수 있다.
파이썬 코드
def show_sentence(text, label="LOVE"):
return f"[{label}] {text}"
print(show_sentence('A person may feel deeply moved by fictional love while remaining emotionally distant in real life.'))
예상 실행 결과
[LOVE] A person may feel deeply moved by fictional love while remaining emotionally distant in real life.
문법 설명
label에 기본값을 지정하여 인수를 생략해도 함수가 실행되도록 합니다.
예제 133
람다로 단어 길이 정렬
Love may also be placed in the past or future instead of practiced in the present.
사랑은 현재에 실천되지 않고 과거나 미래에 놓일 수도 있다.
파이썬 코드
words = ['Love', 'may', 'also', 'be', 'placed', 'in', 'the']
result = sorted(words, key=lambda word: len(word))
print(result)
These fantasies protect the person from the demands of present intimacy.
이러한 환상은 현재의 친밀함이 요구하는 부담으로부터 사람을 보호한다.
파이썬 코드
english = 'These fantasies protect the person from the demands of present intimacy.'.split()[:3]
korean = '이러한 환상은 현재의 친밀함이 요구하는 부담으로부터 사람을 보호한다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
Projective mechanisms can make partners blame each other for their own unrecognized traits.
투사 작용은 상대방이 자신의 인정하지 않은 특성 때문에 비난받게 만들 수 있다.
파이썬 코드
def sentence_length(text):
return len(text)
english = 'Projective mechanisms can make partners blame each other for their own unrecognized traits.'
print(sentence_length(english))
예상 실행 결과
91
문법 설명
문자열을 매개변수로 받고 글자 수를 반환하는 함수를 정의합니다.
예제 137
기본값 매개변수
Parents may also project their unfulfilled ambitions onto their children.
부모 역시 이루지 못한 욕망을 자녀에게 투사할 수 있다.
파이썬 코드
def show_sentence(text, label="LOVE"):
return f"[{label}] {text}"
print(show_sentence('Parents may also project their unfulfilled ambitions onto their children.'))
예상 실행 결과
[LOVE] Parents may also project their unfulfilled ambitions onto their children.
문법 설명
label에 기본값을 지정하여 인수를 생략해도 함수가 실행되도록 합니다.
예제 138
람다로 단어 길이 정렬
Love fails when another person is treated as a tool for self-completion.
다른 사람을 자기 완성을 위한 도구로 대할 때 사랑은 실패한다.
파이썬 코드
words = ['Love', 'fails', 'when', 'another', 'person', 'is', 'treated']
result = sorted(words, key=lambda word: len(word))
print(result)
It seeks honest connection rather than magical rescue.
성숙한 사랑은 마법 같은 구원보다 정직한 연결을 추구한다.
파이썬 코드
english = 'It seeks honest connection rather than magical rescue.'.split()[:3]
korean = '성숙한 사랑은 마법 같은 구원보다 정직한 연결을 추구한다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
def sentence_length(text):
return len(text)
english = 'The practice of love begins with discipline.'
print(sentence_length(english))
예상 실행 결과
44
문법 설명
문자열을 매개변수로 받고 글자 수를 반환하는 함수를 정의합니다.
예제 142
기본값 매개변수
Discipline should become a voluntary rhythm rather than an external punishment.
절제는 외부의 처벌이 아니라 자발적인 생활의 리듬이 되어야 한다.
파이썬 코드
def show_sentence(text, label="LOVE"):
return f"[{label}] {text}"
print(show_sentence('Discipline should become a voluntary rhythm rather than an external punishment.'))
예상 실행 결과
[LOVE] Discipline should become a voluntary rhythm rather than an external punishment.
문법 설명
label에 기본값을 지정하여 인수를 생략해도 함수가 실행되도록 합니다.
예제 143
람다로 단어 길이 정렬
A person who lives chaotically will struggle to practice any art consistently.
혼란스럽게 사는 사람은 어떤 기술도 꾸준히 실천하기 어렵다.
파이썬 코드
words = ['A', 'person', 'who', 'lives', 'chaotically', 'will', 'struggle']
result = sorted(words, key=lambda word: len(word))
print(result)
Loving requires the ability to be fully present with another person.
사랑하려면 다른 사람과 함께 있을 때 온전히 현재에 머물 수 있어야 한다.
파이썬 코드
english = 'Loving requires the ability to be fully present with another person.'.split()[:3]
korean = '사랑하려면 다른 사람과 함께 있을 때 온전히 현재에 머물 수 있어야 한다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
Growth cannot be forced according to a hurried timetable.
성장은 조급한 시간표에 맞추어 강요될 수 없다.
파이썬 코드
english = 'Growth cannot be forced according to a hurried timetable.'.split()[:3]
korean = '성장은 조급한 시간표에 맞추어 강요될 수 없다.'.split()[:3]
for number, pair in enumerate(zip(english, korean), start=1):
print(number, pair)
Modern culture often values speed, but love develops slowly.
현대 문화는 속도를 중시하지만 사랑은 천천히 자란다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(151, 'Modern culture often values speed, but love develops slowly.', '현대 문화는 속도를 중시하지만 사랑은 천천히 자란다.')
print(item.number, item.english)
예상 실행 결과
151 Modern culture often values speed, but love develops slowly.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 152
인스턴스 메서드
The learner must also treat love as a matter of supreme importance.
배우는 사람은 사랑을 가장 중요한 문제로 여겨야 한다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence('The learner must also treat love as a matter of supreme importance.', '배우는 사람은 사랑을 가장 중요한 문제로 여겨야 한다.')
print(item.bilingual())
예상 실행 결과
The learner must also treat love as a matter of supreme importance.
배우는 사람은 사랑을 가장 중요한 문제로 여겨야 한다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 153
예외 처리 try·except
No art can be mastered when it is only a minor hobby.
어떤 기술도 사소한 취미 정도로 다루어서는 숙달할 수 없다.
파이썬 코드
data = {"english": 'No art can be mastered when it is only a minor hobby.'}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 154
텍스트 파일 쓰기
Sensitivity to oneself is part of the practice.
자기 자신에 대한 민감성도 실천의 일부이다.
파이썬 코드
text = 'Sensitivity to oneself is part of the practice.\n자기 자신에 대한 민감성도 실천의 일부이다.'
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 155
텍스트 파일 읽기와 예외 처리
A person must notice fatigue, anxiety, resentment, and inner conflict.
사람은 피로, 불안, 원망, 내적 갈등을 알아차려야 한다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.
예제 156
클래스와 객체 생성
Self-awareness helps prevent unconscious feelings from controlling relationships.
자기 인식은 무의식적 감정이 관계를 지배하는 것을 막아 준다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(156, 'Self-awareness helps prevent unconscious feelings from controlling relationships.', '자기 인식은 무의식적 감정이 관계를 지배하는 것을 막아 준다.')
print(item.number, item.english)
예상 실행 결과
156 Self-awareness helps prevent unconscious feelings from controlling relationships.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 157
인스턴스 메서드
Sensitivity to others requires listening without immediately judging or advising.
다른 사람에 대한 민감성은 곧바로 판단하거나 충고하지 않고 듣는 것을 요구한다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence('Sensitivity to others requires listening without immediately judging or advising.', '다른 사람에 대한 민감성은 곧바로 판단하거나 충고하지 않고 듣는 것을 요구한다.')
print(item.bilingual())
예상 실행 결과
Sensitivity to others requires listening without immediately judging or advising.
다른 사람에 대한 민감성은 곧바로 판단하거나 충고하지 않고 듣는 것을 요구한다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 158
예외 처리 try·except
Practice also demands humility because understanding another person is never complete.
다른 사람을 완전히 이해할 수는 없으므로 실천에는 겸손도 필요하다.
파이썬 코드
data = {"english": 'Practice also demands humility because understanding another person is never complete.'}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 159
텍스트 파일 쓰기
The art of love grows through repeated choices in ordinary life.
사랑의 기술은 일상에서 반복되는 선택을 통해 자란다.
파이썬 코드
text = 'The art of love grows through repeated choices in ordinary life.\n사랑의 기술은 일상에서 반복되는 선택을 통해 자란다.'
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 160
텍스트 파일 읽기와 예외 처리
Grand declarations matter less than consistent acts of attention and care.
거창한 선언보다 꾸준한 관심과 돌봄의 행동이 더 중요하다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.
예제 161
클래스와 객체 생성
Fromm considers rational faith necessary for love.
프롬은 사랑에 이성적 믿음이 필요하다고 본다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(161, 'Fromm considers rational faith necessary for love.', '프롬은 사랑에 이성적 믿음이 필요하다고 본다.')
print(item.number, item.english)
예상 실행 결과
161 Fromm considers rational faith necessary for love.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 162
인스턴스 메서드
Rational faith is confidence grounded in one's own experience and understanding.
이성적 믿음은 자신의 경험과 이해에 근거한 신뢰이다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence("Rational faith is confidence grounded in one's own experience and understanding.", '이성적 믿음은 자신의 경험과 이해에 근거한 신뢰이다.')
print(item.bilingual())
예상 실행 결과
Rational faith is confidence grounded in one's own experience and understanding.
이성적 믿음은 자신의 경험과 이해에 근거한 신뢰이다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 163
예외 처리 try·except
It differs from blind belief in an authority.
그것은 권위에 대한 맹목적인 믿음과 다르다.
파이썬 코드
data = {"english": 'It differs from blind belief in an authority.'}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 164
텍스트 파일 쓰기
To love someone is to have faith in that person's potential for growth.
누군가를 사랑한다는 것은 그 사람의 성장 가능성을 믿는 것이다.
파이썬 코드
text = "To love someone is to have faith in that person's potential for growth.\n누군가를 사랑한다는 것은 그 사람의 성장 가능성을 믿는 것이다."
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 165
텍스트 파일 읽기와 예외 처리
It also requires faith in one's own capacity to love.
그것은 또한 자신이 사랑할 수 있다는 능력에 대한 믿음을 요구한다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.
예제 166
클래스와 객체 생성
Without such faith, fear easily takes control.
그러한 믿음이 없으면 두려움이 쉽게 지배권을 잡는다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(166, 'Without such faith, fear easily takes control.', '그러한 믿음이 없으면 두려움이 쉽게 지배권을 잡는다.')
print(item.number, item.english)
예상 실행 결과
166 Without such faith, fear easily takes control.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 167
인스턴스 메서드
Courage is needed because love always involves risk.
사랑에는 언제나 위험이 따르므로 용기가 필요하다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence('Courage is needed because love always involves risk.', '사랑에는 언제나 위험이 따르므로 용기가 필요하다.')
print(item.bilingual())
예상 실행 결과
Courage is needed because love always involves risk.
사랑에는 언제나 위험이 따르므로 용기가 필요하다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 168
예외 처리 try·except
There is no guarantee that love will be returned or preserved.
사랑이 되돌아오거나 계속 유지된다는 보장은 없다.
파이썬 코드
data = {"english": 'There is no guarantee that love will be returned or preserved.'}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 169
텍스트 파일 쓰기
A person who demands complete certainty cannot love freely.
완전한 확실성을 요구하는 사람은 자유롭게 사랑할 수 없다.
파이썬 코드
text = 'A person who demands complete certainty cannot love freely.\n완전한 확실성을 요구하는 사람은 자유롭게 사랑할 수 없다.'
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 170
텍스트 파일 읽기와 예외 처리
They may protect themselves through distance, control, or cynicism.
그들은 거리 두기, 통제, 냉소를 통해 자신을 보호하려 할 수 있다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.
예제 171
클래스와 객체 생성
Love asks for the courage to be vulnerable without surrendering self-respect.
사랑은 자기 존중을 포기하지 않으면서도 상처받을 가능성을 감수할 용기를 요구한다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(171, 'Love asks for the courage to be vulnerable without surrendering self-respect.', '사랑은 자기 존중을 포기하지 않으면서도 상처받을 가능성을 감수할 용기를 요구한다.')
print(item.number, item.english)
예상 실행 결과
171 Love asks for the courage to be vulnerable without surrendering self-respect.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 172
인스턴스 메서드
Fromm also describes love as activity rather than mere busyness.
프롬은 사랑을 단순한 분주함이 아니라 능동성으로 설명한다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence('Fromm also describes love as activity rather than mere busyness.', '프롬은 사랑을 단순한 분주함이 아니라 능동성으로 설명한다.')
print(item.bilingual())
예상 실행 결과
Fromm also describes love as activity rather than mere busyness.
프롬은 사랑을 단순한 분주함이 아니라 능동성으로 설명한다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 173
예외 처리 try·except
Productive activity expresses a person's powers instead of escaping from the self.
생산적인 활동은 자신에게서 도망치는 것이 아니라 자신의 능력을 표현한다.
파이썬 코드
data = {"english": "Productive activity expresses a person's powers instead of escaping from the self."}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 174
텍스트 파일 쓰기
A loving person actively sees, listens, thinks, and responds.
사랑하는 사람은 능동적으로 보고, 듣고, 생각하고, 응답한다.
파이썬 코드
text = 'A loving person actively sees, listens, thinks, and responds.\n사랑하는 사람은 능동적으로 보고, 듣고, 생각하고, 응답한다.'
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 175
텍스트 파일 읽기와 예외 처리
This activity can be quiet and does not require constant visible action.
이러한 능동성은 조용할 수 있으며 끊임없이 눈에 띄는 행동을 요구하지 않는다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.
예제 176
클래스와 객체 생성
Inner laziness can exist even in a very busy life.
매우 바쁜 삶 속에서도 내적인 게으름은 존재할 수 있다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(176, 'Inner laziness can exist even in a very busy life.', '매우 바쁜 삶 속에서도 내적인 게으름은 존재할 수 있다.')
print(item.number, item.english)
예상 실행 결과
176 Inner laziness can exist even in a very busy life.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 177
인스턴스 메서드
Conversely, stillness can contain deep attention and vitality.
반대로 고요함 속에는 깊은 집중과 생명력이 담길 수 있다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence('Conversely, stillness can contain deep attention and vitality.', '반대로 고요함 속에는 깊은 집중과 생명력이 담길 수 있다.')
print(item.bilingual())
예상 실행 결과
Conversely, stillness can contain deep attention and vitality.
반대로 고요함 속에는 깊은 집중과 생명력이 담길 수 있다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 178
예외 처리 try·except
Faith, courage, and activity strengthen one another in the practice of love.
믿음, 용기, 능동성은 사랑의 실천에서 서로를 강화한다.
파이썬 코드
data = {"english": 'Faith, courage, and activity strengthen one another in the practice of love.'}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 179
텍스트 파일 쓰기
They help a person remain open even after disappointment.
그것들은 실망 뒤에도 사람이 마음을 열어 두도록 돕는다.
파이썬 코드
text = 'They help a person remain open even after disappointment.\n그것들은 실망 뒤에도 사람이 마음을 열어 두도록 돕는다.'
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 180
텍스트 파일 읽기와 예외 처리
Mature love is resilient because it is rooted in character rather than mood.
성숙한 사랑은 기분이 아니라 인격에 뿌리를 두기 때문에 회복력이 있다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.
예제 181
클래스와 객체 생성
The book ultimately presents love as an orientation of the whole personality.
이 책은 궁극적으로 사랑을 인격 전체의 방향성으로 제시한다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(181, 'The book ultimately presents love as an orientation of the whole personality.', '이 책은 궁극적으로 사랑을 인격 전체의 방향성으로 제시한다.')
print(item.number, item.english)
예상 실행 결과
181 The book ultimately presents love as an orientation of the whole personality.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 182
인스턴스 메서드
Love cannot be limited to one favored person while everyone else is treated as an object.
한 사람만 사랑하면서 나머지 모두를 물건처럼 대한다면 그것은 진정한 사랑이 될 수 없다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence('Love cannot be limited to one favored person while everyone else is treated as an object.', '한 사람만 사랑하면서 나머지 모두를 물건처럼 대한다면 그것은 진정한 사랑이 될 수 없다.')
print(item.bilingual())
예상 실행 결과
Love cannot be limited to one favored person while everyone else is treated as an object.
한 사람만 사랑하면서 나머지 모두를 물건처럼 대한다면 그것은 진정한 사랑이 될 수 없다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 183
예외 처리 try·except
The capacity to love appears in friendship, family life, work, and social responsibility.
사랑할 수 있는 능력은 우정, 가족생활, 노동, 사회적 책임에서 드러난다.
파이썬 코드
data = {"english": 'The capacity to love appears in friendship, family life, work, and social responsibility.'}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 184
텍스트 파일 쓰기
A loving orientation affirms life wherever it is encountered.
사랑의 태도는 어디에서 만나든 생명을 긍정한다.
파이썬 코드
text = 'A loving orientation affirms life wherever it is encountered.\n사랑의 태도는 어디에서 만나든 생명을 긍정한다.'
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 185
텍스트 파일 읽기와 예외 처리
This does not mean approving every action or avoiding necessary criticism.
그렇다고 모든 행동을 인정하거나 필요한 비판을 피해야 한다는 뜻은 아니다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.
예제 186
클래스와 객체 생성
Love can oppose injustice because it cares about human dignity.
사랑은 인간의 존엄을 소중히 여기기 때문에 불의에 맞설 수 있다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(186, 'Love can oppose injustice because it cares about human dignity.', '사랑은 인간의 존엄을 소중히 여기기 때문에 불의에 맞설 수 있다.')
print(item.number, item.english)
예상 실행 결과
186 Love can oppose injustice because it cares about human dignity.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 187
인스턴스 메서드
Respectful criticism seeks growth rather than humiliation.
존중하는 비판은 모욕이 아니라 성장을 추구한다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence('Respectful criticism seeks growth rather than humiliation.', '존중하는 비판은 모욕이 아니라 성장을 추구한다.')
print(item.bilingual())
예상 실행 결과
Respectful criticism seeks growth rather than humiliation.
존중하는 비판은 모욕이 아니라 성장을 추구한다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 188
예외 처리 try·except
Social structures can either nourish or obstruct the development of loving character.
사회 구조는 사랑할 수 있는 인격의 발달을 돕거나 방해할 수 있다.
파이썬 코드
data = {"english": 'Social structures can either nourish or obstruct the development of loving character.'}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 189
텍스트 파일 쓰기
A society centered only on profit and competition makes mature love more difficult.
이윤과 경쟁만을 중심으로 하는 사회는 성숙한 사랑을 더 어렵게 만든다.
파이썬 코드
text = 'A society centered only on profit and competition makes mature love more difficult.\n이윤과 경쟁만을 중심으로 하는 사회는 성숙한 사랑을 더 어렵게 만든다.'
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 190
텍스트 파일 읽기와 예외 처리
Fromm therefore links personal transformation with social change.
따라서 프롬은 개인의 변화와 사회의 변화를 연결한다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.
예제 191
클래스와 객체 생성
Individuals must practice love, but they also need humane institutions.
개인은 사랑을 실천해야 하지만 인간적인 제도도 필요하다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(191, 'Individuals must practice love, but they also need humane institutions.', '개인은 사랑을 실천해야 하지만 인간적인 제도도 필요하다.')
print(item.number, item.english)
예상 실행 결과
191 Individuals must practice love, but they also need humane institutions.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 192
인스턴스 메서드
The art of loving is both a private discipline and a cultural challenge.
사랑의 기술은 개인적 수련이면서 문화적 과제이기도 하다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence('The art of loving is both a private discipline and a cultural challenge.', '사랑의 기술은 개인적 수련이면서 문화적 과제이기도 하다.')
print(item.bilingual())
예상 실행 결과
The art of loving is both a private discipline and a cultural challenge.
사랑의 기술은 개인적 수련이면서 문화적 과제이기도 하다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 193
예외 처리 try·except
The book does not offer a simple formula for successful relationships.
이 책은 성공적인 관계를 위한 단순한 공식을 제시하지 않는다.
파이썬 코드
data = {"english": 'The book does not offer a simple formula for successful relationships.'}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 194
텍스트 파일 쓰기
Instead, it asks readers to transform their way of being.
대신 독자에게 존재 방식 자체를 변화시키라고 요청한다.
파이썬 코드
text = 'Instead, it asks readers to transform their way of being.\n대신 독자에게 존재 방식 자체를 변화시키라고 요청한다.'
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 195
텍스트 파일 읽기와 예외 처리
Love requires moving from having to being, from possession to participation.
사랑은 소유에서 존재로, 점유에서 참여로 나아갈 것을 요구한다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.
예제 196
클래스와 객체 생성
It calls for humility, honesty, responsibility, and sustained effort.
사랑은 겸손, 정직, 책임, 지속적인 노력을 요구한다.
파이썬 코드
class LoveSentence:
def __init__(self, number, english, korean):
self.number = number
self.english = english
self.korean = korean
item = LoveSentence(196, 'It calls for humility, honesty, responsibility, and sustained effort.', '사랑은 겸손, 정직, 책임, 지속적인 노력을 요구한다.')
print(item.number, item.english)
예상 실행 결과
196 It calls for humility, honesty, responsibility, and sustained effort.
문법 설명
클래스를 정의하고 생성자에서 번호·영어·한글 속성을 초기화합니다.
예제 197
인스턴스 메서드
The goal is not perfect emotion but a productive relationship to life.
목표는 완벽한 감정이 아니라 삶과 맺는 생산적인 관계이다.
파이썬 코드
class LoveSentence:
def __init__(self, english, korean):
self.english = english
self.korean = korean
def bilingual(self):
return self.english + "\n" + self.korean
item = LoveSentence('The goal is not perfect emotion but a productive relationship to life.', '목표는 완벽한 감정이 아니라 삶과 맺는 생산적인 관계이다.')
print(item.bilingual())
예상 실행 결과
The goal is not perfect emotion but a productive relationship to life.
목표는 완벽한 감정이 아니라 삶과 맺는 생산적인 관계이다.
문법 설명
객체 내부의 두 속성을 결합해 반환하는 인스턴스 메서드를 작성합니다.
예제 198
예외 처리 try·except
A person learns to love by practicing these qualities repeatedly.
사람은 이러한 자질을 반복해서 실천함으로써 사랑을 배운다.
파이썬 코드
data = {"english": 'A person learns to love by practicing these qualities repeatedly.'}
try:
print(data["korean"])
except KeyError:
print("번역 키가 없습니다.")
예상 실행 결과
번역 키가 없습니다.
문법 설명
존재하지 않는 딕셔너리 키를 조회할 때 발생하는 KeyError를 안전하게 처리합니다.
예제 199
텍스트 파일 쓰기
Failure does not end the practice but reveals where further growth is needed.
실패는 실천을 끝내는 것이 아니라 더 성장해야 할 지점을 보여 준다.
파이썬 코드
text = 'Failure does not end the practice but reveals where further growth is needed.\n실패는 실천을 끝내는 것이 아니라 더 성장해야 할 지점을 보여 준다.'
with open("love_sentence.txt", "w", encoding="utf-8") as file:
file.write(text)
print("저장 완료")
예상 실행 결과
저장 완료
문법 설명
with 문으로 파일을 열어 영어 문장과 한글 번역을 UTF-8 형식으로 저장합니다.
예제 200
텍스트 파일 읽기와 예외 처리
Fromm's final message is that love is difficult, demanding, and essential to a fully human life.
프롬의 마지막 메시지는 사랑이 어렵고 많은 노력을 요구하지만 온전한 인간다운 삶에 필수적이라는 것이다.
파이썬 코드
try:
with open("love_sentence.txt", "r", encoding="utf-8") as file:
content = file.read()
print(content)
except FileNotFoundError:
print("파일을 먼저 만들어 주세요.")
예상 실행 결과
파일이 있으면 내용 출력 / 없으면 안내문 출력
문법 설명
파일 읽기 과정에서 파일이 없을 때 발생하는 FileNotFoundError를 처리합니다.