Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Screen shot

>Solution :

I think this f-string should work

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

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading