I tried doing it by changing the jovian module example a bit,
this solution has 2 while loops.

def rev_star(n):
line = '*'
while len(line) <= n-1:
space = n-len(line) # Counter for number of spaces
print(' '*space, line) # Statement to print required number of spaces and line(*)
line += "*"
while len(line) > 0: # Similar loop but for 2nd half of the pattern
space = n-len(line)
print(' '*space, line)
line = line[:-1]

I tried to do it with 1 while loop,

def rev_star2(n):
line = '*'
i = len(line)
while i <= 2*n-1:
space = n-i
if(i>n): # Condition for decreasing 2nd half
print(' '*-space, line*(2*n-i)) # -space to print spaces for the decreasing 2nd half
else:
print(' '*space, line*i) # space to print spaces for increasing 1st half
i += 1

But I donβt think Iβm using string concatenation in the 2nd example(rev_star2).

Output for both: rev_star(6) and rev_star2(6)

*
**
***
****
*****
******
*****
****
***
**
*

Edit:
I tried the 2nd example without using i=len(line) and that does have string concatenation,

def rev_star3(n):
line = '*'
while len(line) <= 2*n-1:
space = n-len(line)
if(len(line)>n): # Condition for decreasing 2nd half
print(' '*-space, line[:2*n-len(line)]) # -space to print spaces for the decreasing 2nd half
else:
print(' '*space, line) # space to print spaces for increasing 1st half
line += '*' # String concatenation

Hi, I did this for the first problem, and it worked. However, I am still new to this, and I am not sure about the exact meaning of [:-1], is it like subtracting 1 each time? Thanks. (Space should be six spaces).

line = β*β
space = " "
max_length = 6

while len(line) <= max_length:
print(space, line)
line += β*β
space = space[:-1]

while len(line) > 0:
print(space, line)
line = line[:-1]
space += " "

Instead, for the second problem I did this. (Space should be six spaces).

line = β*β
space = " "
max_length = 10

while len(line) <= max_length:
print(space, line)
line = line + β**β
space = space[:-1]

while len(line) > 0:
print(space, line)
line = line[:-2]
space += " "

line[:-1] returns all the values stored in the line variable without the last value, what comes before the β:β determines where is starts to pick up values, and if nothing is before the β:β, it means it will pick from the first value to the right value not comprised, where the right value is the one stated after the β:β sign. As -1 is used to indicate the last value of a variable, this means that βline[:-1]β will return every value stored in the variable line untill the last value (not comprised).