Hello, I am currently trying to learn programming and am using Python to start with. I am currently practicing programming with classes and have placed the following code into a python file called complex.py:
class Complex
def __init__(self, realpart, imagpart):
self.r = realpart
self.i = imagpart
and placed the following code into another file named main.py in the same exact folder:
import complex
x = Complex( 3.0, -4.5)
print "x's Real component %s" % x.r
print "x's Imaginary component %s" % x.i
When I ran main.py through the compiler I was given a message claiming that there was no module named Complex. Is there something I did wrong when inputting it?
And by the way, when I added the class definition at the top of the main.py instead of through a whole new file the code compiled perfectly fine.