Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Complex Numbers | Numeric Types
Python Data Types

Sveip for å vise menyen

book
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.

python

Using .real, we can get the real part of any complex number, using .imag method, we can get the imaginary part.

python
Oppgave

Swipe to start coding

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.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 4
Vi beklager at noe gikk galt. Hva skjedde?

Spør AI

expand
ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

book
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.

python

Using .real, we can get the real part of any complex number, using .imag method, we can get the imaginary part.

python
Oppgave

Swipe to start coding

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.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 4
Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Vi beklager at noe gikk galt. Hva skjedde?
some-alt