>>> print range(10)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Integer math works exactly the way you would expect with no horrible surprises at all: >>> print [x * 3 for x in range(10)]
[0, 3, 6, 9, 12, 15, 18, 21, 24, 27]
>>> print [x / 3 for x in range(10)]
[0, 0, 0, 1, 1, 1, 2, 2, 2, 3]
Python is great for little one-off tasks; say you want a color half the brightness of #308cfb >>> hex(0x30 / 2)
'0x18'
>>> hex(0x8c / 2)
'0x46'
>>> hex(0xfb / 2)
'0x7d'
The built-in support for dictionaries and JSON parsing make data conversion easy: >>> import json
>>> json.dumps({'foo': 42, 'bar': 132}.values())
'[42, 132]'
If there's one thing I love about Python, it's how easy and consistent it is. It sure is great that we've spent the last decade teaching Python to every scientist, academic, and hobbyist.If there are two things I love about Python, it's that and the reliable, well-supported Python package manager.