Untitled

Run Settings
LanguagePython
Language Version
Run Command
import re import math class Complex(object): def __init__(self, real, imaginary): self.__real = real self.__imaginary = imaginary def __repr__(self): return (self.__invertedDetectSign(self.__real) + str(self.__real) + self.__invertedDetectSign(self.__imaginary) + str(self.__imaginary) + 'i') def __invertedDetectSign(self, val): return '' if (val < 0) else '+' def getModule(self): return math.sqrt(self.__real**2 + self.__imaginary**2) c = Complex(-5, 20) print(c) print(c.getModule())
Editor Settings
Theme
Key bindings
Full width
Lines