Skip to main content

Library operasi himpunan untuk tugas pemrograman Python

Project description

Himpunan

Sebuah library Python untuk operasi himpunan (Set Operations) yang diimplementasikan menggunakan magic methods Python.

✨ Fitur

  • Membuat, menambah, dan mengurangi anggota himpunan
  • Irisan /
  • Gabungan +
  • Selisih -
  • Selisih Simetris *
  • Komplemen (komplement())
  • Himpunan Kuasa (abs())
  • Produk Kartesius (**)
  • Subset, Superset, dan Ekuivalen (<=, >=, //)

📦 Instalasi

pip install afl2-himpunan

Contoh

from himpunan import Himpunan

S = Himpunan(1,2,3,4,5,6,7,8,9)
h1 = Himpunan(1, 2, 3)
h2 = Himpunan(3, 4, 5)

print(len(h1))  # Output: 3
print(3 in h1)  # Output: True
print(h1 == h2)  # Output: False

h1 += 4  # Menambah elemen 4 ke h1
print(h1)  # Output: Himpunan([1, 2, 3, 4])

h3 = h1 / h2  # Irisan
print(h3)  # Output: Himpunan([3, 4])

h4 = h1 + h2  # Gabungan
print(h4)  # Output: Himpunan([1, 2, 3, 4, 5])

h5 = h1 - h2  # Selisih
print(h5)  # Output: Himpunan([1, 2])

h6 = h1.Komplemen(S)  # Komplemen
print(h6)  # Output: Himpunan([5, 6, 7, 8, 9])

print(abs(h1))  # Output: 16

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

afl2_himpunan-0.1.4.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

afl2_himpunan-0.1.4-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file afl2_himpunan-0.1.4.tar.gz.

File metadata

  • Download URL: afl2_himpunan-0.1.4.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for afl2_himpunan-0.1.4.tar.gz
Algorithm Hash digest
SHA256 f667a4f481b814a2e33688cbdfb1385c4dc1bc1f628228ccd01517261aa5d98d
MD5 44f0dfba6748853f63151e862a78a870
BLAKE2b-256 4509d9425b87830880280bb5ad251b33b7d279f830d1e2c1e90ee320f0c561f2

See more details on using hashes here.

File details

Details for the file afl2_himpunan-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: afl2_himpunan-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for afl2_himpunan-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0caaf53f8d3849faf6a15f4c6c3b38f07e74f983288a068c8948a5312f9ec0f5
MD5 b8b54074e9810945ff0d5343ac810557
BLAKE2b-256 41acf35b587e7ee5b54ef0ff11ccdc37438cec0c88d537861d9258823dd4fe88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page