Scientific Computing with Python Projects - Arithmetic Formatter

Thanks I think I have fixed for that now but there’s a little bug that I don’t really understand in the code:

elif len(problems) == 4:                     
       line1 = arranged_problems.append(f"  {first_numbers[0]:>{max_width}}"   
    f"{first_numbers[1]:>{max_width}}"
    f"{first_numbers[2]:>{max_width}}"
    f"{first_numbers[3]:>{max_width}}\n")
  line2 = arranged_problems.append(f"  {operators[0]}"
    f"{second_numbers[0]:>{max_width}}"        f"{operators[2]}"
    f"{second_numbers[2]:>{max_width}}"
    f"{operators[3]}"
    f"{second_numbers[3]:>{max_width}}\n")
  line3 = arranged_problems.append('-' * (max_width + 2))
                          
  elif len(problems) == 5:              
      line1 = arranged_problems.append(f"  {first_numbers[0]:>{max_width}}"
    f"{first_numbers[1]:>{max_width}}"
    f"{first_numbers[2]:>{max_width}}"
    f"{first_numbers[3]:>{max_width}}"
    f"{first_numbers[4]:>{max_width}}\n")

In the line elif len(problems)==5: it gives me a syntax error when I run it. Im not sure how this is possible. I’ve run it on replit and IDLE and it gives me the same syntax error.

EDIT: Here you can see what it looks like when you nest your code in triple backticks