---
title: "Discussion on \"Five++ cool Python snippets (Part - 2)\" | Hashnode"
description: "Discussion on \"Five++ cool Python snippets (Part - 2)\". Useful Python snippets that can actually save your time"
url: "https://hashnode.com/posts/five-cool-python-snippets-part-2/60dbfe1a7ad49f6471accee8"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Five++ cool Python snippets (Part - 2)](https://apoorvtyagi.tech/five-cool-python-snippets-part-2?utm_source=hashnode&utm_medium=feed)

Useful Python snippets that can actually save your time

Jun 30, 2021 · 4 min read · apoorvtyagi.tech  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#programming-tips](https://hashnode.com/tag/programming-tips)
-   [#productivity](https://hashnode.com/tag/productivity)
-   [#beginners](https://hashnode.com/tag/beginners)
-   [#programming](https://hashnode.com/tag/programming)

## Written by

[Apoorv Tyagi](https://hashnode.com/@apoorvtyagi)

@apoorvtyagi · India

  
[View profile](https://hashnode.com/@apoorvtyagi)

Senior Software Engineer | Tech Blogger | !(Chess GM)

Senior Software Engineer. I write about practical tips and epic stories about my experiences in the field of computer science and engineering!

## Responses 1

Markdown supported · ⌘↵ to post

[Amal Shaji](https://hashnode.com/@amal)

[Jun 30, 2021](https://hashnode.com/posts/five-cool-python-snippets-part-2/60dbfe1a7ad49f6471accee8/comment/60dc22847ad49f6471acd4d3)

Fixes:

1.  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]]
    ```
    
2.  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)
    ```
    

[Apoorv Tyagi](https://hashnode.com/@apoorvtyagi)

[Jun 30, 2021](https://hashnode.com/posts/five-cool-python-snippets-part-2/60dbfe1a7ad49f6471accee8/comment/60dc22847ad49f6471acd4d3#reply-60dc29377ad49f6471acd706)

Hey [Amal Shaji](https://hashnode.com/@amal) Thanks for pointing this out :)
