Lesson 20 of 34
Sets: மீண்டும் வராத மதிப்புகள்
7 min 25 XP
set-ல் ஒரே மதிப்பு இரண்டு முறை இருக்காது. ஒரு list-லிருந்து நகல்களை (duplicates) நீக்க set() மிக எளிய வழி.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.இரண்டு sets-ஐ ஒப்பிடலாம்: | (union) இரண்டிலும் உள்ள அனைத்தும், & (intersection) இரண்டிலும் பொதுவானவை, - (difference) முதலில் மட்டும் உள்ளவை.
Example: edit me and press Run
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.set-க்கு வரிசை (order) இல்லை, எனவே set[0] வேலை செய்யாது. வரிசைப்படி வேண்டுமென்றால் sorted() பயன்படுத்துங்கள்.