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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: afl2_himpunan-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 0e4fb32ceb96724334eb55bbcd6dde3e11050f9235b02d8ee370f55c65aa6af0
MD5 2db2876e99d6f1a9e72c7bd5af9dfd59
BLAKE2b-256 6c7d8b8dafc6041fb64ba0a70bbd4c034d334eb1582172033a28cc8c1cae4cbf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: afl2_himpunan-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 73a72ad233a5359d8d6cb79cce10ba7c3b9c046540d5e27a65b5864d4549c0b3
MD5 46355cf58bbed8e8487847250bac8f73
BLAKE2b-256 947540868edcd05246214d3c4be9cd6b4d89a3a76b60a2dc15bc727bdac99e02

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