Skip to content

Commit

Permalink
9.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pigmal24 committed May 19, 2024
1 parent bde4ade commit 35162dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions YWCHOI/1to10/9.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def solution(num) :
digit = []
while num > 0:
id = num % 2
digit.append(str(id))
num //= 2
digit.reverse()
return ''.join(digit) #여기에서 좀 걸림

print(solution(10)) #반환값 : 1010
print(solution(27)) #반환값 : 11011
print(solution(12345)) #반환값 : 11000000111001

0 comments on commit 35162dd

Please sign in to comment.