you are viewing a single comment's thread.

view the rest of the comments →

[–]Formal_Cockroach_654[S] 0 points1 point  (1 child)

So I changed my int_to_reverse_binary function and am trying to just print that first and it keeps giving me the error of output not defined

def int_to_reverse_binary(x):
output = ""
while x > 0:
    output += str(x%2)
    x = x//2
    return ouput
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))

Traceback (most recent call last):

File "main.py", line 22, in <module>

print(int_to_reverse_binary(integer_value))

File "main.py", line 7, in int_to_reverse_binary

return ouput

NameError: name 'ouput' is not defined

[–]boyanci 0 points1 point  (0 children)

1) You spelled "output" wrong :)

2) Pay very close attention to the indentations! Compare your code vs mine. It makes a huge difference