How do i get my code to return the the answer without the extra '' and ()

Pls, provide a more readable code listing the next time.

You can simply use format() method that each string object can perform.
This may be helpful.

In your case it will be something like this:

return "The text contains {} alphabetic characters, of which {} ({}) are 'e'".format(len(new_string), total_e, percentage)

Browse More Popular Posts

Leave a Comment