"The girls eat the cakes."
Translation:Le ragazze mangiano le torte.
All nouns are either masculine or feminine: una torta - a cake (feminine), un panino - a sandwich (masculine). You just have to learn the gender as you learn the word.
There are many different words for 'the' depending on the gender, number and beginning letter of the following word.
Masculine singular - il
Masculine singular which begins with a z, s+consonant, ps, x, gn - lo
Masculine singular when starting with a vowel - l'
Feminine singular - la
Masculine plural - i
Masculine plural where the singular would have taken lo or l' - gli
Feminine plural - le
As girls (ragazze) and cakes (torte) are both feminine plural, we use 'le' for both of them.