파이썬 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는 사용하지 않아요!

  • (•́ ✖ •̀)
    알 수 없는 사용자

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)