영역확장

2026년 10월 22일 09:30분

사무엘하 8장에서 다윗은 연속으로 주변 민족들을 정복하여 영토를 넓힙니다. 반복적인 승리가 영역을 확장합니다. 나는 정복 결과를 누적하는 확장 함수를 만들었습니다.

package com.jesusbornd.samuel2;
import java.util.ArrayList;
import java.util.List;

public class Samuel2_08_Chapter_Lv1 {
    public static void main(String[] args) {
        var territory = new ArrayList<String>();
        List.of("모압","소바","다메섹","에돔","암몬","블레셋").forEach(nation -> {
            territory.add(nation);
            System.out.printf("정복: %-8s → 영토 %d곳%n", nation, territory.size());
        });
    }
}

territory = []
for nation in ["모압", "소바", "다메섹", "에돔", "암몬", "블레셋"]:
    territory.append(nation)
    print(f"정복: {nation:<8} → 영토 {len(territory)}곳")

Comments

Avatar
 2026년 10월 22일 11:36분

한 번의 승리가 다음 승리의 기반이 됩니다.



Search

← 목록으로