Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started