Coder Social home page Coder Social logo

terbilang's Introduction

terbilang

terbilang adalah sebuah alat yang berfungsi untuk mengubah angka menjadi huruf terbilang. terbilang ditulis dengan Python dan dapat menerima masukan angka hingga 72 digit (999+ miliar novemdesiliun).

Instalasi

pip install terbilang

Penggunaan

terbilang dapat dijalankan langsung sebagai skrip Python:

python -m terbilang

Jika anda adalah pengembang, terbilang juga bisa digunakan sebagai modul:

from terbilang import Terbilang

t = Terbilang()

t.parse('1.000,00')
print(t.getresult()) # seribu koma nol nol

t.parse('1001')
print(t.getresult()) # seribu satu

t.parse('121001')
print(t.getresult()) # seratus dua puluh satu ribu satu

Standar pemisah desimal yang digunakan oleh terbilang adalah koma (,), ini bisa diganti pada saat inisiasi:

t = Terbilang(sep='.')

print(t.parse('1000.456').getresult()) # seribu koma empat lima enam

terbilang dibuat agar memiliki jangkauan yang lebar, tetapi diharapkan dapat membaca angka dengan lebih luwes. Sebagai contoh, "1000 triliun" tidak dibaca sebagai "satu kuadriliun" tetapi "seribu triliun". Sedangkan "1000 juta" tentu akan dibaca sebagai "satu miliar". terbilang akan menampilkan tanda koma jika bilangan sudah mencapai triliunan atau lebih untuk meningkatkan keterbacaan:

t.parse('19000000000000000000071000002011000000')
print(t.getresult()) # sembilan belas undesiliun, tujuh puluh satu ribu triliun, dua miliar sebelas juta

terbilang's People

Contributors

nggit avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

terbilang's Issues

No Unit test?

At least some test cases makes this lib more convincing

Do you still open for PR?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.