<commit_before>#!/usr/bin/env python
def dec_to_bin(dec):
    result = dec / 2
    rest = dec % 2
    print "%s \t:\t 2 = %s \t-- Rest: %s" % (dec,int(result),rest)
    if int(result) != 0:
        binary = str(rest) + str(dec_to_bin(int(result)))
        return binary
    else:
        return str(rest)

def dec_to_hex(dec):
    substitution = {
        "10" : "A",
        "11" : "B",
        "12" : "C",
        "13" : "D",
        "14" : "E",
        "15" : "F"
    }
    result = dec / 16
    rest = str(dec % 16)
    print "%s \t:\t 16 = %s \t-- Rest: %s" % (dec,int(result),rest)
    if rest in substitution:
        rest = rest.replace(rest,substitution[rest])

    if int(result) != 0:
           hexa = str(rest) + str(dec_to_hex(int(result)))
           return hexa
    else:
        return str(rest)

def main():
    number = 123455
    binary = dec_to_bin(number)
    print "dec: %s = bin: %s\n" % (number,binary[::-1])
    hexa = dec_to_hex(number)
    print "dec: %s = hex: %s\n" % (number,hexa[::-1])
    

if __name__ == "__main__":
    main()
<commit_msg>Added bin to dec function<commit_after>#!/usr/bin/env python
def dec_to_bin(dec):
    result = dec / 2
    rest = dec % 2
    print "%s \t:\t 2 = %s \t-- Rest: %s" % (dec,int(result),rest)
    if int(result) != 0:
        binary = str(rest) + str(dec_to_bin(int(result)))
        return binary
    else:
        return str(rest)

def dec_to_hex(dec):
    substitution = {
        "10" : "A",
        "11" : "B",
        "12" : "C",
        "13" : "D",
        "14" : "E",
        "15" : "F"
    }
    result = dec / 16
    rest = str(dec % 16)
    print "%s \t:\t 16 = %s \t-- Rest: %s" % (dec,int(result),rest)
    if rest in substitution:
        rest = rest.replace(rest,substitution[rest])

    if int(result) != 0:
           hexa = str(rest) + str(dec_to_hex(int(result)))
           return hexa
    else:
        return str(rest)

def bin_to_dec(binary):
    decimal = 0
    reversed_binary = str(binary)[::-1]
    for digit in range(len(reversed_binary)):
        decimal = decimal + int(str(reversed_binary)[digit]) * (2 ** digit)

    return decimal

def main():
    number = 123455
    binary_input = 1111
    binary = dec_to_bin(number)
    print "dec: %s = bin: %s\n" % (number,binary[::-1])
    hexa = dec_to_hex(number)
    print "dec: %s = hex: %s\n" % (number,hexa[::-1])
    print "bin: %s = dec: %s\n" % (binary_input, bin_to_dec(binary_input))

if __name__ == "__main__":
    main()

{'fraction_non_alphanumeric': 0.17723052079127977, 'fraction_numerical': 0.027856277755349212, 'mean_word_length': 2.1974193548387095, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3573519', 'n_tokens_mistral': 1007, 'n_tokens_neox': 952, 'n_words': 232}