Skip to content

Tag: python-3.x

Count input length without spaces, periods, or commas

How do you count the length of a string (example “Hello, Mr. John. Have a good day.” taking out the commas, periods and white spaces? The count should be 23. I’m coming up with 33 with the commas, periods and white spaces. Answer The @yixizhou answer is simple and accurately a good one but i…

Python Split and calculate

I use an API for the license overview, there I can see when and for how long I have used a program. The usage time is displayed in a table as 10 min or as 1 h 10 min. Now I would like to have an printout under this table with the total used usage time. It Prints: How can

Tkinter button color flashing for no reason

I’m making a refresh function to change the color of a button in tkinter, the problem is that this color must come from another function that returns a string and everytime I update everything flashes for a moment. I’ve tried using StringVar() and only update the color without updating the whole l…

How to add() runtime input in a set in python?

Problem I am trying to add() elements in a set at run time using a for loop: Surprisingly, l1 is a set but, when I go on add() -ing elements to my set l2 in a loop I get : TypeError: unhashable type: ‘list’ Research Effort: Here are other ways I have tried to add() elements to set l2 and