Play audio with Python

You can find information about Python audio here: http://wiki.python.org/moin/Audio/ It doesn’t look like it can play .mp3 files without external libraries. You could either convert your .mp3 file to a .wav or other format, or use a library like PyMedia.

Printing subscript in python

If all you care about are digits, you can use the str.maketrans() and str.translate() methods: Which will output: Note that this won’t work in Python 2 – see Python 2 maketrans() function doesn’t work with Unicode for an explanation of why that’s the case, and how to work around it.

Python Set Comprehension

I simplified the test a bit – if all(x%y instead of if not any(not x%y I also limited y’s range; there is no point in testing for divisors > sqrt(x). So max(x) == 100 implies max(y) == 10. For x <= 10, y must also be < x. Instead of generating pairs of primes and … Read more

Python for C++ Developers

I never really understood the “Language X for Language Y developers” approach. When I go looking to learn Language X I want to learn how to program in it the way that Language X programmers do, not the way Language Y programmers do. I want to learn the features, idioms, etc. that are unique to … Read more