Twelve days of Christmas

Twelve days of Christmas

An English Christmas carol.

“The Twelve Days of Christmas” is an English Christmas carol that enumerates in the manner of a cumulative song a series of increasingly numerous gifts given on each of the twelve days of Christmas.


– The gift on the first day is a partridge in a pear tree.

– The gift on the second day is two turtle doves.

– The gift on the third day is three french hens.

– The gift on the fourth day is four calling birds.

– The gift on the fifth day is five gold rings.

Make


Write a program that outputs the song, “The Twelve Days of Christmas”.

Use this boilerplate code as a starting point:

Success Criteria

Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.

Complete the subprogram called `output_song` that:

  1. Outputs the song, “The twelve days of Christmas” in the most efficient way.

Hint: use a list of the days, “first”, “second” etc. Use a list of the gifts. Iterate over both lists.

Complete the `main program` so that:

  1. It calls the `output_song` procedure.

Typical inputs and outputs from the program would be:

On the first of Christmas

My true love gave to me

A partridge in a pear tree.


On the second of Christmas

My true love gave to me

Two turtle doves

And a partridge in a pear tree.


On the third of Christmas

My true love gave to me

Three french hens

Two turtle doves

And a partridge in a pear tree.


On the fourth 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 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.

Knowledge Organiser

Use these resources as a reference to help you meet the success criteria.

Programming guide:

Evaluate


Run the unit tests below to check that your program has met the success criteria.

On the first of Christmas

My true love gave to me

A partridge in a pear tree.


On the second of Christmas

My true love gave to me

Two turtle doves

And a partridge in a pear tree.


On the third of Christmas

My true love gave to me

Three french hens

Two turtle doves

And a partridge in a pear tree.


On the fourth 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 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.

Check that you have:

  • Used comments within the code to describe the purpose of subprograms, conditions and iterations.
  • Used meaningful identifier names. That means the names of subprograms and variables indicate what they are for.
Craig'n'Dave logo

Craig ‘n’ Dave

In partnership with

Mission Encodeable
Bett Awards 2024 Finalist