Lesson 17 of 34

List Methods: जोडा, काढा, Sort करा

9 min 25 XP

append() शेवटी जोडते, insert() ठराविक जागी जोडते, remove() एक value काढते, आणि pop() शेवटचा item बाहेर काढते.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

संख्यांच्या list साठी sum(), max() आणि min() खूप उपयोगी. sort() लहान ते मोठे लावते; sort(reverse=True) उलटे.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

एका ओळीतून अनेक संख्या वाचण्यासाठी: input().split() strings ची list देते; प्रत्येक int मध्ये बदला.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

Challenge

+25 XP

Spaces ने वेगळ्या केलेल्या संख्यांची एक ओळ दिली आहे (Input box पाहा). सर्वात मोठी आणि सर्वात लहान यातील फरक (max - min) print करा.

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.