Answers for "python convert number to binar"

9

convert int to binary python

# Python program to convert decimal to binary 
    
# Function to convert Decimal number  
# to Binary number  
def decimalToBinary(n):  
    return bin(n).replace("0b", "")  
    
# Driver code  
if __name__ == '__main__':  
    print(decimalToBinary(8))  
    print(decimalToBinary(18))  
    print(decimalToBinary(7))  
    
Output:
1000
1001
Posted by: Guest on April-04-2020
9

how to convert decimal to binary python

a = 5
#this prints the value of "a" in binary
print(bin(a))
Posted by: Guest on March-09-2020
0

python convert number to binar

1652430994
Posted by: Guest on December-24-2020

Code answers related to "python convert number to binar"

Browse Popular Code Answers by Language