Lesson 20 of 34
Sets: மீண்டும் வராத மதிப்புகள்Sets: Unique Values Only
7 min 25 XP
set-ல் ஒரே மதிப்பு இரண்டு முறை இருக்காது. ஒரு list-லிருந்து நகல்களை (duplicates) நீக்க set() மிக எளிய வழி.
A set never holds the same value twice. set() is the easiest way to remove duplicates from a list.
Example: edit me and press Run
Press Run to see the result here.இரண்டு sets-ஐ ஒப்பிடலாம்: | (union) இரண்டிலும் உள்ள அனைத்தும், & (intersection) இரண்டிலும் பொதுவானவை, - (difference) முதலில் மட்டும் உள்ளவை.
Compare two sets: | (union) is everything, & (intersection) is what both share, and - (difference) is what only the first has.
Example: edit me and press Run
Press Run to see the result here.set-க்கு வரிசை (order) இல்லை, எனவே set[0] வேலை செய்யாது. வரிசைப்படி வேண்டுமென்றால் sorted() பயன்படுத்துங்கள்.
Sets have no order, so set[0] doesn't work. Use sorted() when you need them in order.