Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions