This is homework, so I'll give you no code!
But...it's not that difficult if you think about it, and break it down into chunks.
Start by writing a function to print a line: two parameters, number of spaces, and number of stars. That's almost trivial!
Then look at your required output: it's in two halves:
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
Increasing stars, then
* * * * * * *
* * * * *
* * *
*
Decreasing stars.
So treat it as two halves!
Look at the "increasing stars" section and it's really three sections:
. . . . * . . . .
. . . * * * . . .
. . * * * * * . .
. * * * * * * * .
* * * * * * * * *
4 spaces, 1 star, 4 spaces.
3 spaces, three stars, 3 spaces.
2 spaces, five stars, 2 spaces.
1 space, seven stars, 1 space.
0 spaces, nine stars, 0 spaces.
Looked at like that, each line has nine characters, so the stars count is (line number * 2) + 1 : 0*2+1 = 1, 1*2+1 = 3, and so on.
And the total spaces count is 9 - the stars count.
So to draw a line, take the line number (starting from zero), double it and add one - that's the number to pass to the "draw a line" function as the "number of stars". And the "number of spaces" is (9 - number of stars) / 2
Decreasing the number of stars is the same process with slightly different calculations.
Try it! It's really not complicated if you think about it.