Created
September 11, 2017 13:33
-
-
Save JackInTaiwan/c34219ac7d50d221b2a66eb002e7d7f5 to your computer and use it in GitHub Desktop.
Python_convert science notation
This file contains 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 convert(num) : | |
num = str(num) | |
if ('e' in num): | |
index = num.index('e') | |
power = num[index+1::] | |
power = int(power) | |
num_num = num[:index] | |
output = '0.' + '0'*(abs(power)-1) + num_num | |
return (output) | |
else : | |
return (int(num)) | |
a=0.00000000005 | |
print (convert(a)) #0.00000000005 instead of 5e-11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment