Offical web page Pynumeral
PyNumeral v1.0
PyNumeral python library for formatting and manipulating numbers
Create a simple program in pynumeral (construction)
Creating a simple program with the PyNumeral library is explained below with code and comments:
import pynumeral # importing pynumeral
'''
we store the functions in the pynumeral document to the num variable.
'''
num = pynumeral # this in num variable
num.format( # use format function
num = 10.4, # declare a number for formatting
form = "0.!0" # format type
# value: 10
)
Docs
Run this library
Install .zip file in github
Copy file: pynumeral-1.0.3/bin/pynumeral.py
Create new folder and paste pynumeral.py
Create new (for example test.py) .py file in this folder (the folder must contain a pynumeral file)
Write the code to your newly opened .py file and run it, following the PyNumeral syntax
Importing PyNumeral
In python file
import pynumeral # importing pynumeral
format() function
you can format any number from the format() function to percentages, integers, rounded numbers, currencies, odd-evens, and more. Syntax:
num.format(
num = 10.5,
form = "<0.0>"
)
Numbers
| Number | Type | Value |
| 100 | "0.0" | 100.0 |
| -100 | "||" | 100 |
| 100.3 | "0.!0" | 100 |
| 2 | "0,0t" | 2 ,000 |
| 3 | "0t" | 3 000 |
| 15 | "0,0m" | 15 ,000000 |
| 100 | "m" | 100 000 000 |
| 100 | "+0" | +100 |
| 100.8 | "<0.0>" | 101 |
| 100.1 | "!0.0" | 0.09999999999999432 |
| 51, 52 | "1", "2", "3", "on" | 51 st, 52 nd, 53 rd, 100 th |
| 1200 | "0a" | 1.2k |
| 100 | "(0.000)" | ( 100, 000) |
| 100 | "0.0" | 100.0 |
| 100 | "0%2" | even |
Bytes
| Number | Type | Value |
| 1048577 | "0b" | 0.0009765634313225746 GB |
| 1024 | "0b" | 1.0 KB |
| 234000 | "0b" | 0.2231597900390625 MB |
| 104857756 | "0b" | 9.536757352179848e-05 TB |
Currency
| Number | Type | Value |
| 100 | "$0.0" | 100.0 |
| 100 | "$0.0" | $ 100.0 |
| 100 | "$0k" | $ 100 k |
| 100 | "$0m" | $ 200 m |
Percentages
| Number | Type | Value |
| 1 | "0%" | 100 % |
| 0.25 | "0%" | 25 % |
Time
| Number | Type | Value |
| 49 | "00:00:00" | 00:00:49 | 120 | "00:00:00" | 00:2.0:49 |
Unformatting
Got a formatted string? Use the unformat function to make it useful again.
num.unform(
num = 20,
type = "0%"
# value: 0.2
)
| Value | Type | Number |
| 20.2 | "0.0" | 20 |
| 20 | "0.!0" | 20.0 |
| 35 | "||" | 35 |
| 20 | "0k" | 20000 |
| 15 | "0m" | 15000000 |
| 20 | "0%" | 0.2 |
Manipulate
In PyNumeral, manipulation is generated mainly in variables.
a = 12 # variable for manipulate
num.add(
num = a, # get value
set = 1
# value: 13
)
Actions on numbers
In the PyNumeral library, numbers can be added, subtracted, multiplied, and divided.
# add numbers
num.add(
num = 14,
set = 12
# value: 26
)
# subtract numbers
num.sub(
num = 14,
set = 12
# value: 2
)
# multiply numbers
num.mul(
num = 14,
set = 12
# value: 168
)
# division numbers
num.div(
num = 14,
set = 12
# value: 1.166666666666667
)
Difference
Find the difference between any two numbers in pynumeral.
num.dif(
num = 900,
set = 100
# value: difference 800
)
Clone
A PyNumeral clone is a manipulation of this variable and consists of a clone name and contains a value.
a = 12
num.clone(
name = "myclone",
set = a
'''
Output:
Name clone: myclone
Value clone: 12
'''
)
Value
The value() function stores the value
num.val(100)
Encryption of zeros
In PyNumeral, the encryption of zeros is done using the zeroform() function.
num.zeroform(
code = "Z/N",
num = "0.0"
'''
Output:
number: Z/N
'''
)
How to create language
Create your number formats:
num.makelang(
lang="uzb",
abb_k="ming",
abb_m="million",
abb_b="milliard",
abb_t="trillion",
curr="so'm",
num=1000
'''
Output:
1.0 ming
so'm 1000
'''
)

Top comments (0)