파이썬 Decimal 에서 binary로 while loop 사용해서 convert
조회수 474회
For example, to convert the number 92 to binary:
92 / 2 - quotient = 46 remainder = 0
46 / 2 - quotient = 23 remainder = 0
23 / 2 - quotient = 11 remainder = 1
11 / 2 - quotient = 5 remainder = 1
5 / 2 - quotient = 2 remainder = 1
2 / 2 - quotient = 1 remainder = 0
1 / 2 - quotient = 0 remainder = 1
이런식으로 결과를 내고싶은데 아무리 구글링해도 divmod나 다른 방법밖에 안써서 여기서 여쭈어봅니다.. break와 continue는 사용하지 않아요!
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력