Teks sumber — English
Terjemahan — Bahasa Indonesia
Sets
Himpunan *Set*
Python also includes a data type for :ref:`sets <types-set>`. A set is an unordered collection with no duplicate elements. Basic uses include membership testing and eliminating duplicate entries. Set objects also support mathematical operations like union, intersection, difference, and symmetric difference.
Curly braces or the :func:`set` function can be used to create sets. Note: to create an empty set you have to use ``set()``, not ``{}``; the latter creates an empty dictionary, a data structure that we discuss in the next section.
Kurung kurawal atau fungsi :func:`set` dapat digunakan untuk membuat himpunan. Catatan: untuk membuat himpunan kosong Anda harus menggunakan ``set()``, bukan ``{}``; yang terakhir itu membuat kamus *dictionary* kosong, struktur data yang kita bahas di bagian selanjutnya.
Because sets are unordered, iterating over them or printing them can produce the elements in a different order than you expect.