0

Hi I am having trouble making my print statement look how I want it to, this is causing my assignment to fail on an autograder. currently my code responsible for outputting the final statement looks like

    retStr = []
    for candidate in eliminated:
        retStr.append(candidate) #+= candidate + ", "
    # e_order = ""
    # for x in range(len(retStr)):
    #     e_order = e_order + x

    print("Elimination order: ", retStr)
main()

and the final output looks like Elimination order: ['3', '5', '4', '2', '1']

how do I make it so that the final output looks like Elimination order: 3, 5, 4, 2, 1

exactly and no comma at the end or anything it needs the spaces and needs to look exactly like that

I would really appreciate if someone could help me out with this :)

Peter
  • 1
  • 3

1 Answers1

0

You can try below solution by converting list into string and then appending it to print statement:.

print("Elimination order:", ', '.join(retStr))
Vaibhav Jadhav
  • 2,000
  • 1
  • 5
  • 19