Category Archives: Python

How to run Python inside vim

To run the current open Python program in vim, type: :!python % If you are new here, you might want to subscribe to the RSS feed or newsletter. Enter your email address:

Posted in Python | Tagged , | Leave a comment

How to store functions in a dictionary in Python

In Python you can store functions in a dictionary. You can then call the functions via the dictionary key. Continue reading

Posted in Python | Tagged , , , | Leave a comment

The intersection of two Python lists using Set

Python Set is unordered unique collection of objects. We can use Set to find the intersection of two lists/tuples. Continue reading

Posted in Python | Tagged , , , , | 1 Comment

How to sort a Python tuple

Python tuple is immutable. Therefore, it cannot be changed. To sort a Python tuple, we can create a new list using sorted() method. Continue reading

Posted in Python | Tagged , , , | Leave a comment

How to sort a Python list

The Python list can be sorted by directly applying the sort() method to the list, and indirectly by using the sorted(). Continue reading

Posted in Python | Tagged , , , | Leave a comment