python - Formatting Complex Numbers -
for project in 1 of classes have output numbers 5 decimal places.it possible output complex number , unable figure out how output complex number 5 decimal places. floats know just:
print "%0.5f"%variable_name
is there similar complex numbers?
for questions this, python documentation should first stop. specifically, have @ section on string formatting. lists string format codes; there isn't 1 complex numbers.
what can format real , imaginary parts of number separately, using x.real
, x.imag
, , print out in a + bi
form.
Comments
Post a Comment