How to remove space between expression and period within a string? (Python 3)

Good Morning,

I’ve been trying to get rid of the space between the period and the number generated from sum(random_list) output [23739]. But can’t seem to figure out how without turning the entire string to an f-string. I understand adding the comma will automatically insert a space, but can anyone let me know if there’s an easier method? Thank you!

The picture below is my work;

Screen shot

>Solution :

I think this f-string should work

pritn(f"The sum of the elements in random list is {sum(random_list)}.")

Leave a Reply