Skip to main content

A simple package to limit numbers to a marked area (can be used to simulate number overflows)

Project description

Limited Numbers

A simple library made with Python

Installation

Windows

pip3 install limited-numbers

Linux

python3 -m pip install limited-numbers

Usage

You can use to simulate number overflows (useful if you wanna simulate x-bit numbers)

from limited_numbers import Int

#let's simulate a 8-bit number
number = Int(255) 
'''Int takes 1 positional and 2 keyword arguments. The positional parameter is the number limit after which overflows. The other 2 are to set the number to else than 0 and the other is the lower limit (begin_from)'''

#increase by 1
number += 1

#loop until it overflows
while number!=0:
    print('Number: {}').format(number.get()) #or number.number 
    #PS. Used .format above so that the code is highlighted in Markdown
    number+=1

You can also subtract from the number

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

limited-numbers-1.1.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file limited-numbers-1.1.0.tar.gz.

File metadata

  • Download URL: limited-numbers-1.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.2

File hashes

Hashes for limited-numbers-1.1.0.tar.gz
Algorithm Hash digest
SHA256 98dcae50e19681004a7ddbd90ae986e0a986a4f057ddb4f1c3eb37b0973ad0b5
MD5 c53825beee026cbb1099937351ebddc6
BLAKE2b-256 162774c638173737272d39e182e0f4d5f09732d3ca62f9a01f051070cde899ad

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