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==0.1.2

Contoh

from afl2_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.2.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.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: afl2_himpunan-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 f6427853b2e19af17eb6acbf9f0e66268c188a14f961c9201c58711d8e27a503
MD5 58f7ac84a346e37ad64cab87c02b6a28
BLAKE2b-256 28879d420f6c969750e2182520e405128c9a29cff7d67cdb2a2288ee740dd6a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: afl2_himpunan-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f5a47e7eb1140ffa92e48314c121f77eb62728c2c90a0a12c2afc18b2e4dcb4f
MD5 bc39d270c0b2581d8dfdad730a428b71
BLAKE2b-256 27ef2a3c6e3bef76dfda41c4dd96ad85ca1fd9be78fbd7280ea71c123afe37f9

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