converting binary to octal in python
biNum = '1010'
print(oct(int(biNum, 2))[2:])
converting binary to octal in python
biNum = '1010'
print(oct(int(biNum, 2))[2:])
binary to octal in python
==== Convert binary to octal in Python =====
binaryNum = '11001100' # input a binary
decimalNum = int(binaryNum, 2) # base 2 to base 10
print(decimalNum, type(decimalNum)) # 204 <class 'int'>
octalNum = oct(decimalNum)[2:] # base 10 to base 8
print(octalNum, type(octalNum)) # 314 <class 'str'>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us