Answer the question
In order to leave comments, you need to log in
How to change the number size?
If you try to store a number in an N-bit variable that requires more than N bits for its record, then the high-order bits of the number will be cut off. For example, if you store the value 10 in a two-bit unsigned variable, then the value of this variable will be equal to 2.
I did this:
A = int('10', 2)
print A#Output : 2
Is this correct, or is it just a coincidence?
Answer the question
In order to leave comments, you need to log in
two bits will either be 00 or 01 or 10 or 11. This way you will only get 0, 1, 2, 3 in decimal.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question