Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Convertion of number into binary using NumPy binary_repr

# welcome to softhunt.net
# Python program explaining
# binary_repr() function

import numpy as np
num = 15

print ("Input number : ", num)

ans = np.binary_repr(num)
print ("binary representation of 15 : ", ans)
Comment

Convertion of an array into binary using NumPy binary_repr

# welcome to softhunt.net
# Python program explaining
# binary_repr() function
import numpy as np

arr = [12, -33 ]

print ("Input array : ", arr)

# binary representation of first array
# element without using width parameter
ans = np.binary_repr(arr[0])
print ("Binary representation of 12 Without using width parameter : ", ans)

# binary representation of first array
# element using width parameter
ans = np.binary_repr(arr[0], width = 7)
print ("Using width parameter: ", ans)


# binary representation of 2nd array
# element without using width parameter
ans = np.binary_repr(arr[1])
print ("Binary representation of -33 Without using width parameter : ", ans)

# binary representation of 2nd array
# element using width parameter
ans = np.binary_repr(arr[1], width = 7)
print ("Using width parameter : ", ans)
Comment

PREVIOUS NEXT
Code Example
Python :: All possible combinations of multiple columns 
Python :: python subprocess redirect a file 
Python :: django view - Generic class based view (listc, create, retrieve, update or delete - GET, POST, GET, PUT, DELETE) 
Python :: django filter empty onetoone exists 
Python :: http://172.18.0.128:8114/ 
Python :: python override inherited method 
Python :: enumerate and looping backward 
Python :: adjoint of 3x3 matrix in python 
Python :: penggunaan values di python 
Python :: Remove Brackets from List Using the Translate method 
Python :: python call c function 
Python :: Visual Studio Code pylint: Error when all is ok 
Python :: XML to table form in Excel 
Python :: opencv2.3 
Python :: pixel accuracy image segmentation python 
Python :: lmplot color] 
Python :: if no python 
Python :: Redirect to the same page and display a message if user insert wrong data 
Python :: win10 python com ports 
Python :: dataframe get missing and zero values 
Python :: python entry element 
Python :: localizar la fila y columna de un dato pandas 
Python :: python graph 
Python :: mehrzeiliges kommentar python 
Python :: insertar valor python 
Python :: python strip txt 
Python :: create new column pandas and order sequence 
Python :: python making player equipment 
Python :: how to assign a value to a key dictionary in a list python 
Python :: mod trong python 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =