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.5

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: afl2_himpunan-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 cd4d83e4b6599cfb1fd0bc2fe83a98025bc01dd1eb784d8d7878a1bdb020aec5
MD5 b7c4ba7bda723024a35b904ac06251c9
BLAKE2b-256 1ebe892e03f052402f63997f0a509fc4907817f0464078c9a53a51411496ad59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: afl2_himpunan-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dabd48d78c53f0b3887a01c9e987497e7e3a035a6d7cfa1cd8e9d21d19a08204
MD5 8b593e91f4f4f3c7dc3ac15e57f9c519
BLAKE2b-256 5deb138636b74b096f893708f3cd51505e1354dc811d2203cac384c7525e9e3a

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