weargenius.in
Python program to find the binary equivalent of any decimal - WeArGenius
This is a simple program in python to find the binary equivalent of any given decimal base number. This basically takes input as a decimal base number and coverts it into binary base and prints it. Sample Outputs: The Code: def bin(x): b="" if(x==0): #The Binary equivalent of decimal 0 is 0 b=str(0) while(x>0): b=b+str(x%2) #Typecasting an Integer to String x=x/2 b=b[::-1] #Reverse the String print binp=input()bin(inp) Description:firstly input is taken from the keyboard and stored in inp variable. Then this variable is passed to bin() from where operations are…