Why Python 3.6.1 throws AttributeError: module ‘enum’ has no attribute ‘IntFlag’?

It’s because your enum is not the standard library enum module. You probably have the package enum34 installed. One way check if this is the case is to inspect the property enum.__file__ Since python 3.6 the enum34 library is no longer compatible with the standard library. The library is also unnecessary, so you can simply uninstall it. If you need the code … Read more

How to display text in pygame?

You can create a surface with text on it. For this take a look at this short example: This creates a new object on which you can call the render method. This creates a new surface with text already drawn onto it. At the end you can just blit the text surface onto your main screen. Bear … Read more

Apply function to each element of a list

I think you mean to use map instead of filter: Even simpler, you could use str.upper instead of importing from string (thanks to @alecxe): In Python 2.x, map constructs a new list by applying a given function to every element in a list. filter constructs a new list by restricting to elements that evaluate to True with a given function. In Python 3.x, map and filter construct iterators instead of lists, so … Read more