my code stock.com

Snippet options

Download: Download snippet as binary-to-result.py.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

def temp(binary):

    listOfBinary = []

    for i in range(len(binary)):
        if binary[i] != " ":
            listOfBinary.append(binary[-i-1])
        else:
            pass
        
    binaryToDec = 0

    if listOfBinary[-1] == "0":
        for i in range(len(listOfBinary)):
            if listOfBinary[i] != "0":
                binaryToDec += 2**i
        result = binaryToDec * 0.0625

    if listOfBinary[-1] == "1":
        for i in range(len(listOfBinary)):
            if listOfBinary[i] != "1":
                binaryToDec += 2**i
        result = -binaryToDec * 0.0625 - 0.0625  

    return result

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.