Please can anyone tell me how to get the following output in python:
9.4605e+12
I typed it that way
S_L = "2.998765e+08"
print "S_L"
But it did not work
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get print a number with exponent notation by using string formatting:
And in your case above, you are probably getting
S_Las the output because you have quotes aroundS_L, which means it is getting interpreted as a string and not the contents of theS_Lvariable. In that specific case, you could do: