Bruh how to delete 0j thing | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Bruh how to delete 0j thing

I have a strange 0j thing in the output https://code.sololearn.com/cjPXWGC7Qg0C/?ref=app

7th Nov 2019, 8:18 PM
Piterden
4 Answers
+ 8
Python uses j to represent complex numbers. Here's some information on what complex numbers are and why Python uses j instead of i. https://www.mathsisfun.com/numbers/complex-numbers.html https://stackoverflow.com/questions/24812444/why-are-complex-numbers-in-python-denoted-with-j-instead-of-i
7th Nov 2019, 9:47 PM
Koketso Dithipe
Koketso Dithipe - avatar
+ 6
All numbers can be expressed (in Python) as: a+bj For real constants a and b where j=sqrt(-1) For real numbers, they have no imaginary part so b = 0. To correct your code, you could use math instead of cmath.
7th Nov 2019, 11:38 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
By the way, don’t use semicolons in Python unless you write two statements on one line (not generally recommended anyway)
8th Nov 2019, 3:05 AM
Rora
8th Nov 2019, 3:39 AM
Siyabonga Samson Lukhele
Siyabonga Samson Lukhele - avatar