It is a method in tuple that returns a sorted list of the original tuple in ascending order by default. It returns a list.
Syntax:
sorted(iterable, key, reverse=True/Flase)
Note: reverse=True will sort the tuple in descending order.
Don’t know what is min method in Python Tuple? Read: Python Tuple – min() Method
Example 1:
# Python program to understand sorted() method in tuple # www.codewindow.in s = (2, 9, 7, 9, 33, 45, 52) x = sorted(s) print(x)
Output:
[2, 7, 9, 9, 33, 45, 52]
Explanation:
It returned a list (x) which is sorted. Here the elements are in sorted order (ascending).
Example 2:
# Python program to understand sorted() method in tuple # www.codewindow.in s = ("Name", "Codewindow", "India") x = sorted(s) print(x)
Output:
['Codewindow', 'India', 'Name']
Explanation:
Here it returned a list (x) in sorted (ascending) order alphabetically according to their ascii value of the first character of that element.
Example 3:
# Python program to understand sorted() method in tuple # www.codewindow.in s = [2, 9, 7, 9, 1, 45, 8] x = sorted(s, reverse=True) print(x)
Output:
[45, 9, 9, 8, 7, 2, 1]
Explanation:
Here the elements are in sorted order but reversed (descending). It returned a list which is sorted in descending order.
You Missed
- Wipro NLTH Coding Solve | Digital Secure Data Transfer Solutions | Codewindow.in
- Elementor #57063
- 1xBet ile Etkili Bahis Stratejileri
- Ontdek Casino Online Buitenland: Voordelen en Meer
- Casino Online Buitenland Ervaar de Beste Spellen
- Азино Мобайл Зеркало – Преимущества И Недостатки Работы Онлайн
- Казино Польша Онлайн Бесплатные Игры
- Топ-5 Отечественных Систем Для Управления Проектами: Что Подходит Для Десятков Проектов Сервисы На Vc Ru
- Online Casino Buitenland Verkennen
- Online Casino Zonder Cruks: De Vrijheid van Spelen
- Лучшие Торговые Стратегии Форекс 2025: Обзор Самых Прибыльных
- vhod-v-kazino-r7
- 1King casino Türkiye Bahis Adresi — Güvenilir ve Hızlı
- onlayn-kasino-turbo
- oficialnyy-sayt-kazino-turbo
- pinko-kazino
- oficialnyy-sayt-kazino-r7
- pinko-oficialnyy-sayt
- pinko-zerkalo
- riobet-kazino
- riobet-kazino
- riobet-oficialnyy-sayt-kazino
- Casino zonder Cruks Ervaar Vrijheid en Spanning
- The Future of Science: How Emerging Technologies Are Transforming Research
- Winorio online casino – een recente ontdekking bedoeld voor Nederlandse spelers: pluspunten van deze recente internet gokhuis
- Bahis Dunyasinda Most bet ile Yerinizi Alin
- Natural Remedies for Potency: Effective Ways to Enhance Male Vitality
- рейтинги казино
- Mostbet ile bahis yaparak kazan
- Unieke Casino Ervaringen Zonder CRUKS Nederland
- What Is Internet Application Development? Definition + Examples
- Breitling replica watches
Also Checkout
- 3484
- Adobe
- Advanced Coading
- Advanced course
- Ajax
- Algorithm
- Amagi
- Amazon Interview Questions
- Angular JS
- anonymous
- Aptitude
- Aptitude tricks
- Automata Fixing
- Basic Coding
- big data
- Bookkeeping
- Books
- Bridge2i
- C programming
- Campgemini Interview Questions
- Capgemini Coding Questions
- Capgemini Pseudocode
- casino online buitenland2
- casino zonder cruks 4
- casino zonder cruks nederland
- Celebal Tech
- Cloud Computing
- code nation
- Coding Questions
- Cognizant Placement
- commvault Systems
- Computer Network
- CSS
- CTS
- Data Science
- Data Structure
- Data Structure and Algorithm
- DBMS
- De Show Interview Questions
- deloitte
- Deutsche Bank Interview questions
- ð¥ð¢ð╗ð░ð©╠åð¢ ð║ð░ðÀð©ð¢ð¥ ð┐ð¥ð╗ÐîÐêð░
- Enhance Communication
- Epam Full Question Paper
- Extempore
- Exxon Mobil interview questions
- filpkart
- Fractal Analytics Interview Questions
- general
- Genpact
- Grab
- GreyB Interview Questions
- Group Discussion
- Guidance for Accenture
- Gupshup
- Hackathon 2024
- HCL Interview Questions
- Hexaware
- HFCL
- HR Questions
- HTML5
- httpscasinozonder-cruks.xyz
- IBM Interview questions
- IBM Questions
- Incture Interview Questions
- Infineon Technologies Interview Questions
- Infosys
- Infosys Interview Questions
- Internship
- Interview Experience
- Interview Questions
- IT Образование
- ITC Infotech
- itron
- JavaScript
- JECA
- Job Info
- JQuery
- Kantar Interview Questions
- Language Confusion
- language confussion
- Larsen & Turbo
- Latenview AnalyticsInterview questions
- Lexmark International Interview Questions
- Machine Learning
- Media.net
- Mindtree Interview Questions
- misc
- Miscellaneous
- Mock Test Series
- MongoDB
- Morgan Stanly Interview Questions
- nagarro
- navi
- NodeJS
- NTT Data Interview Questions
- NVDIA
- NVDIA interview questions
- online casino buitenland
- Operating System
- Optum
- other
- PayU
- Persistent INterview Questions
- PHP and MYSQL
- Previous Coding Questions
- Programming in C
- Programming in C++
- Programming in JAVA
- Programming in Python
- Pseudo Code
- pseudocode
- Public
- PWC Interview Questions
- Python
- Quiz
- Razorpay
- ReactJS
- Recruiting Companies
- Revature
- salesforce
- Samsung
- Schlumberger
- Seimens
- Slice
- Smart Cube
- Software development
- Software Engineering
- Study Material
- Tally Solutions
- tata cliq
- TCS
- TCS NQT
- TCS NQT Coding Questions
- Tech Mahindra Coding Questions
- Tech Mahindra Questions
- Technical Preparation
- Teg Analytics
- Tejas Network Interview Questions
- Texas Instrument Interview Questions
- Tiger Analytics
- Uncategorized
- UnDosTres
- Unstop
- Verbal Ability
- Verbal Lesson
- Web Development
- wipro
- Wipro Coding Questions
- Wipro interview Questions
- Wipro NLTH
- WIpro NLTH Coding Solve
- Zenser
- Zoho Interview Questions
- Форекс обучение