열두 날

열두 날

쉬움

지침

이 연습 문제에서 해야 할 일은 "The Twelve Days of Christmas"라는 노래의 가사를 반환하는 코드를 작성하는 거예요.

"The Twelve Days of Christmas"는 널리 알려진 영어 크리스마스 캐럴이에요. 노래의 각 절은 그 앞 절에 이어서 내용이 쌓여 가요.

코드가 반환하는 가사는 아래에 나온 전체 노랫말과 정확히 일치해야 해요.

가사

On the first day of Christmas my true love gave to me: a Partridge in a Pear Tree.

On the second day of Christmas my true love gave to me: two Turtle Doves, and a Partridge in a Pear Tree.

On the third day of Christmas my true love gave to me: three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

On the fourth day of Christmas my true love gave to me: four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

On the fifth day of Christmas my true love gave to me: five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

On the sixth day of Christmas my true love gave to me: six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

On the seventh day of Christmas my true love gave to me: seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

On the eighth day of Christmas my true love gave to me: eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

On the ninth day of Christmas my true love gave to me: nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

On the tenth day of Christmas my true love gave to me: ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

On the eleventh day of Christmas my true love gave to me: eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

On the twelfth day of Christmas my true love gave to me: twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.

참고

각 절의 목록을 만들어 두면 편리해요:

#(
'a Partridge in a Pear Tree'
'two Turtle Doves'
'three French Hens'
'four Calling Birds'
'five Gold Rings'
'six Geese-a-Laying' 
'seven Swans-a-Swimming' 
'eight Maids-a-Milking' 
'nine Ladies Dancing'
'ten Lords-a-Leaping' 
'eleven Pipers Piping' 
'twelve Drummers Drumming'
)

출처

Wikipedia링크가 새 창이나 탭에서 열려요
GitHub에서 편집 링크가 새 창이나 탭에서 열려요
Pharo Exercism

열두 날 문제를 시작해 볼 준비가 됐나요?

Exercism에 가입하고 Pharo 트랙을 연습 문제 50개, 그리고 실제 사람의 멘토링과 함께 배우고 익혀 보세요. 모두 무료예요.