'Already updated my pip, still failed to add circle as a module
- I have been searching for different methods for using a class method to create circles. At first, I was able to print 'c1', however, after updating my python, it said is not defined which confuses me.
def __int__(x0, y0, r):
self.x0 = x0
self.y0 = y0
self.r = r
# create a unit circle centered at (0,0)
c1 = Circle(0, 0, 1)
# create a circle of radius 3 centered at (0,0)
c2 = Circle(0, 0, 3)
# create a unit circle centered at (2, 5)
c3 = Circle(2, 5, 1)
# create a circle of radius 3 centered at (4, 2)
c4 = Circle(3, 4, 2)
print (c1)
--------------------------------------------------------------
from circle.Circle import move
c1_xdelta = 4
c1_ydelta = 5
for i in range(1, 20):
if i%10 == 0:
c1.move(c1_xdelta, c1_ydelta)
from circle.Circle import move
c1_xdelta = 4
c1_ydelta = 5
for i in range(1, 20):
if i%10 == 0:
c1.move(c1_xdelta, c1_ydelta)
from circle.Circle import move
c1_xdelta = 4
c1_ydelta = 5
for i in range(1, 20):
if i%10 == 0:
c1.move(c1_xdelta, c1_ydelta)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent
call last)
~\AppData\Local\Temp/ipykernel_7076/1685247526.py in <module>
----> 1 from circle.Circle import move
2 c1_xdelta = 4
3 c1_ydelta = 5
4
5 for i in range(1, 20):
ModuleNotFoundError: No module named 'circle'
Is there any method that I can solve it or any recommended websites for such programming functions? Thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
