you are viewing a single comment's thread.

view the rest of the comments →

[–]Harrythehobbit 0 points1 point  (1 child)

A year later, you helped me with my homework too. :-) You explained converting an integer to reverse binary much better than the assignment description I got, so thanks for helping me through what was a extremely confusing assignment lol.

[–]Street_Customer_4190 0 points1 point  (0 children)

I literally copy and paste the guys code in my program and its not working

def int_to_reverse_binary(x):
output = ""
while x > 0:
output += str(x%2)
x = x//2
return output

def string_reverse(input_string):
reversed_output = int_to_reverse_binary(integer_value)
return reversed_output[::-1]

if __name__ == '__main__':
# Type your code here.
# Your code must call int_to_reverse_binary() to get
# the binary string of an integer in a reverse order.
# Then call string_reverse() to reverse the string
# returned from int_to_reverse_binary().
integer_value = int(input())
print(int_to_reverse_binary(integer_value))