Created
June 20, 2016 22:11
-
-
Save brettfreer/0ec9e952f777b7d883f259c2fb29b4c7 to your computer and use it in GitHub Desktop.
Remove trailing zeros from a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove_trailing_zeros(s): | |
while s[-1] == '0': | |
s = s[:-1] | |
return s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment