Ekene Agunechemba

One day, a boy named Tobi discovered a magical number in his computer class. It wasnโ€™t just any number โ€” it was a complex number. This number had two special parts: a real part (just like normal numbers we use every day) and an imaginary part (a little magical twist!).

Tobi typed this into his computer:

magic_number = 2 + 3j

He asked his teacher, โ€œWhatโ€™s this 3j?โ€

His teacher smiled and said, โ€œThe 2 is your regular number โ€” itโ€™s real. But the 3j is imaginary. Itโ€™s like adding a sprinkle of magic to the number. Thatโ€™s why we call it a complex number โ€” because itโ€™s made of two parts.โ€

Tobi was curious. He asked, โ€œCan I make this number in another way?โ€

โ€œYes!โ€ the teacher said. โ€œTry this:

magic_number = complex(2, 3)

That gives you the same magical number!โ€

Then Tobi wanted to see the two parts separately. So he asked the computer:

magic_number.real

The computer replied: 2.0. โ€œThatโ€™s the real part!โ€ Tobi shouted.

Next, he tried:

magic_number.imag

The computer answered: 3.0. โ€œThatโ€™s the imaginary part โ€” the magic!โ€

Finally, Tobi wondered, โ€œWhat kind of number is this really?โ€

So he asked:

type(magic_number)

And the computer said: <class 'complex'>

Tobi grinned. โ€œNow I know! Complex numbers are like a mix of real life and a bit of magic. Just like me!โ€


๐Ÿง  Review Questions

1. Fill in the blanks

A complex number has two parts: a __________ part and an __________ part.


2. True or False

The letter j in a complex number stands for โ€œjust another number.โ€ โ˜ Trueโ€ƒโ€ƒโ˜ False


3. Multiple Choice

Which one of these creates a complex number?

A. magic = 2 + 3 B. magic = complex(2, 3) C. magic = 2 - 3 D. magic = real(2, 3)


4. Short Answer

If magic_number = 2 + 3j, what is magic_number.real? Answer: ___________


5. What will this code show?

type(2 + 3j)

A. <class 'float'> B. <class 'int'> C. <class 'complex'> D. <class 'magic'>


<
Previous Post
๐Ÿงฎ Python Numbers: Explore Numbers in Python-Integers, Floats, and Complex Numbers!
>
Next Post
Stick to the Plan โ€“ Mastering Internal Warfare as a Tech Trainer