Зміст курсу
Python Data Types
Python Data Types
Complex Numbers
What are complex numbers and how are they represented in Python? A complex number is a number that is the sum of the real and imaginary parts. In Python, the real part is represented by an ordinary int or float, and the imaginary part is an int or float with a suffix j
. Let's look at examples, so that it becomes clearer for us.
Using .real
, we can get the real part of any complex number, using .imag
method, we can get the imaginary part.
Завдання
Create one variable: a
with the following value: -7+3j
. Check the type of this object.
And display the real and imaginary parts of this number.
Дякуємо за ваш відгук!
Complex Numbers
What are complex numbers and how are they represented in Python? A complex number is a number that is the sum of the real and imaginary parts. In Python, the real part is represented by an ordinary int or float, and the imaginary part is an int or float with a suffix j
. Let's look at examples, so that it becomes clearer for us.
Using .real
, we can get the real part of any complex number, using .imag
method, we can get the imaginary part.
Завдання
Create one variable: a
with the following value: -7+3j
. Check the type of this object.
And display the real and imaginary parts of this number.
Дякуємо за ваш відгук!
Complex Numbers
What are complex numbers and how are they represented in Python? A complex number is a number that is the sum of the real and imaginary parts. In Python, the real part is represented by an ordinary int or float, and the imaginary part is an int or float with a suffix j
. Let's look at examples, so that it becomes clearer for us.
Using .real
, we can get the real part of any complex number, using .imag
method, we can get the imaginary part.
Завдання
Create one variable: a
with the following value: -7+3j
. Check the type of this object.
And display the real and imaginary parts of this number.
Дякуємо за ваш відгук!
What are complex numbers and how are they represented in Python? A complex number is a number that is the sum of the real and imaginary parts. In Python, the real part is represented by an ordinary int or float, and the imaginary part is an int or float with a suffix j
. Let's look at examples, so that it becomes clearer for us.
Using .real
, we can get the real part of any complex number, using .imag
method, we can get the imaginary part.
Завдання
Create one variable: a
with the following value: -7+3j
. Check the type of this object.
And display the real and imaginary parts of this number.