DEV Community

Ganesh Chandrasekaran
Ganesh Chandrasekaran

Posted on

1

How to sort tuples in Python ?

Tuples are immutable, but there is a simple way to sort them.

Convert the Tuple to List by using sorted function
then cast the List to Tuple.

Alt Text

Source : with lambda examples

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more