Kaydet (Commit) 4b3ed5d8 authored tarafından Mark Dickinson's avatar Mark Dickinson

Fix typo in Python equivalent for bit_length.

üst ba666a59
...@@ -471,7 +471,7 @@ Additional Methods on Integer Types ...@@ -471,7 +471,7 @@ Additional Methods on Integer Types
Equivalent to:: Equivalent to::
def bit_length(self): def bit_length(self):
s = bin(x) # binary representation: bin(-37) --> '-0b100101' s = bin(self) # binary representation: bin(-37) --> '-0b100101'
s = s.lstrip('-0b') # remove leading zeros and minus sign s = s.lstrip('-0b') # remove leading zeros and minus sign
return len(s) # len('100101') --> 6 return len(s) # len('100101') --> 6
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment