Answers for "generate binary number in python"

0

generate binary number in python

num = int(input("Enter a number: ")) #generates a number
print(int(bin(num[2:]))) #converts the number to binary and prints it
#the [2:] is there because there is a b showing it is bnary but we dont want that in a binary number
Posted by: Guest on April-19-2022

Code answers related to "generate binary number in python"

Python Answers by Framework

Browse Popular Code Answers by Language