How to resolve the algorithm The Twelve Days of Christmas step by step in the 11l programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm The Twelve Days of Christmas step by step in the 11l programming language

Table of Contents

Problem Statement

Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas. The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)

Let's start with the solution:

Step by Step solution about How to resolve the algorithm The Twelve Days of Christmas step by step in the 11l programming language

Source code in the 11l programming language

V gifts = |‘A partridge in a pear tree.
            Two turtle doves
            Three french hens
            Four calling birds
            Five golden 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’.split("\n")

V days = ‘first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth’.split(‘ ’)

L(day) days
   V n = L.index + 1
   V g = reversed(gifts[0 .< n])
   print("\nOn the #. day of Christmas\nMy true love gave to me:\n".format(day)‘’g[0 .< (len)-1].join("\n")‘’(I n > 1 {" and\n"g.last} E g.last))

  

You may also check:How to resolve the algorithm Check Machin-like formulas step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Fibonacci sequence step by step in the Battlestar programming language
You may also check:How to resolve the algorithm Concurrent computing step by step in the Cind programming language
You may also check:How to resolve the algorithm Loops/For step by step in the Verilog programming language
You may also check:How to resolve the algorithm Power set step by step in the Wren programming language