This is a multi part lesson where the same code is reused with additions and a few subtractions. The tail is 4 led lights at the back of the robot just in front of the microbit display. It use RGB parameters that are used with the beak light and one more parameter that tell which of the 4 lights you want to use. 

OLTail1 (copy Beak2 and paste it into a new project)
Block Code Image for Tail1

use Libraries.Robots.BirdBrain.Finch
Finch finch
repeat 3 times
finch:SetTail("All",100, 0, 0)
finch:Pause(0.5)
finch:SetTail(1, 0, 100, 0)
finch:Pause(0.5)
finch:SetTail(2,0, 0, 100)
finch:Pause(0.5)
finch:StopAll()
end
finch:Disconnect()

You can change your code by replacing old code with just a few clicks. In the Edit Menu you will find Replace or use CONTROL H. If you copied the Beak=2 code in to your new project you would want to replace SetBeak with SetTail. Use the replace all choice and changes all of this at once. 

You need add a another parameter that tell the robot what light you want to use. There are 4 lights 1,2,3, and 4. This goes in the first spot. You can also use text "All" in the first spot to effect all 4 lights at the same time.  Text must be inside of "parentheses marks". 

OL2Tail2
use Libraries.Robots.BirdBrain.Finch
use Libraries.Compute.Random
Random random
Finch finch
integer r=20
integer g=20
integer b =30
integer l=4
repeat 25 times
finch:SetTail(l,r, g, b)
//finch:Pause(0.05)
finch:StopAll()
l=random:RandomInteger(3)+1
r=random:RandomInteger(100)
g=random:RandomInteger(100)
b=random:RandomInteger(100)
end
finch:Disconnect()

New: Variables, random and comments.
We are going to make four integer variables, one for the number of the lamp to be lit and three for the different color values. The first time you name a variable, you need to preceded it with the type, this time they are integers. Variables can also be numbers, text, or  true/false. We will need to use another use statement: Libraries.Compute.Random and then create another action named random. 
We are going to make use of random to create the number of the lamp we want to light and  RGB percent for each of the three colors. The higher the number, the brighter that component of the LED light will be brighter.
the variable l (L)  is to choose which of the 4 light we going use. RandomInteger will pick an integer between 0 and the number we choose. As the only valid integers for l are 1,2,3,&4. to make this happen we set the (3) and add 1 one. This avoid getting a zero. 

the // (two slash marks) in line 11 mean to ignore this line. That is how we make a comment that does not effect the code, To make the flashing go slower just delete out the // and the pause will happen.

 

Samples of all the color Codes