Lesson 17 of 34

List Methods: சேர், நீக்கு, வரிசைப்படுத்துList Methods: Add, Remove, Sort

9 min 25 XP

append() கடைசியில் சேர்க்கும், insert() குறிப்பிட்ட இடத்தில் சேர்க்கும், remove() ஒரு மதிப்பை நீக்கும், pop() கடைசி மதிப்பை எடுத்துக் கொடுக்கும்.

append() adds to the end, insert() adds at a position, remove() deletes a value, and pop() takes out the last 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) தலைகீழாக.

For number lists, sum(), max() and min() are very handy. sort() orders from small to large; sort(reverse=True) does the opposite.

Example: edit me and press Run

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

ஒரே வரியில் space விட்டு பல எண்களைப் பெற: input().split() ஒரு list தரும்; ஒவ்வொன்றையும் int ஆக்க வேண்டும்.

To read many numbers from one line: input().split() gives a list of strings; convert each one to 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

ஒரு வரியில் space விட்டு எண்கள் வரும் (Input பெட்டியைப் பாருங்கள்). அவற்றில் பெரியது மற்றும் சிறியதின் வித்தியாசத்தை (max - min) print செய்யுங்கள்.

One line of space-separated numbers is given (see the Input box). Print the difference between the largest and the smallest (max - min).

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