Lesson 18 of 34
Tuples: மாற்ற முடியாத listTuples: Lists that Don't Change
7 min 20 XP
tuple என்பது ( ) அடைப்புக்குறியில் எழுதப்படும் list போன்றது. ஆனால் உருவாக்கிய பிறகு மாற்ற முடியாது. மாறக்கூடாத தகவல்களுக்கு (பிறந்த தேதி, GPS இடம்) இது சிறந்தது.
A tuple is like a list written with ( ), but it cannot be changed after it's created. Great for data that shouldn't change, like a date of birth or a GPS location.
Example: edit me and press Run
Press Run to see the result here.Unpacking: tuple-ன் மதிப்புகளை ஒரே வரியில் பல variables-க்கு கொடுக்கலாம். இதைக் கொண்டு இரண்டு variables-ஐ எளிதாக மாற்றலாம் (swap).
Unpacking: give a tuple's values to several variables in one line. It also makes swapping two variables easy.
Example: edit me and press Run
Press Run to see the result here.ஒரே ஒரு மதிப்புள்ள tuple-க்கு கமா வேண்டும்: (5,). (5) என்பது வெறும் எண் 5.
A one-item tuple needs a comma: (5,). Plain (5) is just the number 5.