Search posts, tags, users, and pages
Apoorv Tyagi
Senior Software Engineer | Tech Blogger | !(Chess GM)
Introduction ๐ Python is a beautifully designed high-level interpreted programming language that provides us with many features. This is a gentle guide to some of those Python features that you probably might not be aware of or didn't know about tha...
Fixes:
Lambda Function
>>> arr_list = [[1, 4], [3, 3], [5, 7]] >>> sorted_list = sorted(arr_list, key=lambda x: x[1]) >>> sorted_list [[3, 3], [1, 4], [5, 7]]
Sliding windows
>>> from itertools import islice >>> def slide(list_name, window_size): ... z = [islice(list_name, i, None) for i in range(window_size)] ... return zip(*z)
Amal Shaji
web + devtools = โค๏ธโ๐ฅ
Hey Amal Shaji Thanks for pointing this out :)
Fixes:
Lambda Function
Sliding windows
>>> from itertools import islice >>> def slide(list_name, window_size): ... z = [islice(list_name, i, None) for i in range(window_size)] ... return zip(*z)