TI-84 Plus CE Python: IPv4 Address to Binary Converter

Layer8

Administrator
Staff member
If you're working with networking, subnetting, or just learning how IPv4 addresses work at the binary level, the TI-84 Plus CE Python Edition can be turned into a handy little IP conversion tool.

I wrote this simple Python program to enter an IPv4 address and convert each decimal octet into its 8-bit binary equivalent.

The Program​

Create a Python program on the calculator named:
IPBIN


Code:
while True:
    ip=input("IP: ")
    p=ip.split(".")

    for x in p:
        n=int(x)
        b=bin(n)[2:]
        b="0"*(8-len(b))+b
        print(x+" = "+b)

    print("")
    print("1 = Another")
    print("2 = Quit")
    choice=input("Choice: ")

    if choice!="1":
        break

Feel free to modify it to your liking.
 
Back
Top