In python documentation it is wrote for built-in function complex([real[imag]]):
..or convert a string or number to a complex number.
But when I try:
>>> complex('string')
I get:
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ValueError: complex() arg is a malformed string
I don’t understand something. I will be glad if someone tells me what is about?
Sorry if this question is simple, but i just start to learn python.
The
complexfunction is used for working with complex numbers (http://en.wikipedia.org/wiki/Complex_number), of the form a+bj. So you can use it like this: