The number of boys 8. Hence, the number of girls is 20 – 8 = 12.
The number of boys, who have a speaking part in the play is 5. Hence, the number of boys, who do not have a speaking part in the play is 8 – 5 = 3.
The number of girls, who do not have a speaking part in the play is 7. Hence, the number of girls, who have a speaking part in the play is 12 – 7 = 5.
Hence, consider the below contingency table:
Gender Speaking part in play No speaking part in play Row Total
Boy 5 3 8
Girl 5 7 12
Column Total 10 10 20
The total number of children, who have a speaking part is 10.
Thus, if a child from the cast of the play is chosen at random, the probability that the child has a speaking part is 10/20 = 1/2 = 0.5.