subject

Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0
Output x % 2 (remainder is either 0 or 1)
x = x // 2
Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string.
Ex: If the input is:
6
the output is:
110
Your program must define and call the following two functions. The function integer_to_reverse_binary() should return a string of 1's and 0's representing the integer in binary (in reverse). The function reverse_string() should return a string representing the input string in reverse.
def integer_to_reverse_binary(integer_v alue)
def reverse_string(input_string)
Note: This is a lab from a previous chapter that now requires the use of a function.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:00
How can data be added to a new table in data base
Answers: 1
question
Computers and Technology, 22.06.2019 05:00
Which two editions of windows 7 support 64 bit cpus? choose two out of professional, business, starter, or home premium.
Answers: 1
question
Computers and Technology, 22.06.2019 07:30
Jasper and samantha are in a robotics competition. the guidelines state that the robots should be able to move a 10-gram weight at least 2 meters and turn in a circle. jasper and samantha have already built the robot. which step of the design process should they follow next to decide whether their robot meets the minimum criteria for the competition?
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
During physical science class ben and jerry connected three identical lightbulbs in parallel to a battery where happens when ben removes one of the lightbulbs from it’s socket
Answers: 2
You know the right answer?
Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's repre...
Questions
question
Mathematics, 05.09.2020 07:01
question
Geography, 05.09.2020 07:01
question
Mathematics, 05.09.2020 07:01
question
Spanish, 05.09.2020 07:01
question
Mathematics, 05.09.2020 07:01
Questions on the website: 13722361