Question: python 3 def FractiontoBinary(number): if(number >= 1 or number 0): # Multiply number by two temp = number * 2 if (temp>= 1): output =

python 3

def FractiontoBinary(number):

if(number >= 1 or number <= 0): return "Input is not in real number" output = "." while(number > 0): # Multiply number by two temp = number * 2 if (temp>= 1): output = output + "1" number = temp - 1 else: output = output + "0" number = temp return output num=float(input('Enter real number in base 10: ')) ans = FractiontoBinary(num) print(num,' ->',ans)

how would i changes this so it can do base 8,16,60 in the program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!