The complex function in Python is a built-in function that stores numbers as complex numbers. The syntax is complex ([real[, imaginary]]). The following code prints out a real number in complex form. a = complex(1.5) print(a) How would the code need to be altered to change the number to have an imaginary part of 2? (1 point) Responses a = complex(1.5) b = complex(2) a = complex(1.5) b = complex(2) a = complex(1.5,2) a = complex(1.5,2) a = complex(2) a = complex(2) a = complex(2,1.5)

1 answer

The code would need to be altered to have an imaginary part of 2 by changing the syntax to a = complex(1.5, 2).

So the correct option would be: a = complex(1.5, 2)