The bin() function is used to convert an integer number to a binary string. String type with the original value expressed as a series of 1s and 0s preceded by 0b.
bin(number)
number: required a integer number
(number could be a variable, but the content of the variable must be an integer number)
Returns binary string of the parameter
(note: the data type of output binary string is integer)
code.py output:
Original number: 10
Binary string:0b1010
Original number: -10
Binary string:-0b1010