# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. def to_binary(n: int)->str: answer = "" while n: answer =str( n % 2) + answer n //= 2 return answer # Press the green button in the gutter to run the script. if __name__ == '__main__': assert to_binary(5) == "101" assert to_binary(1) == "1" assert to_binary(8) == "1000" assert to_binary(15) == "1111" print(to_binary(5)) print(to_binary(1)) print(to_binary(8)) print(to_binary(15)) # See PyCharm help at https://www.jetbrains.com/help/pycharm/