Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 problem with class method
#1
Hi experts. I am new to Python but understand programming and have a fair idea about it. I need your help for following.

I am trying to execute the following code but getting an error. Both error and code provided below.

class Circle():
    pie=3.14
    def __init__(self,radius=1):
        self.radius=radius
        self.area=pie*radius*radius
        
        
    def Circum(self):
        return(2*self.pie*self.radius)

mycircle=Circle()
mycircle.Circum()     # I get error here when calling this function

Error:
TypeError: Circum() takes 0 positional arguments but 1 was given
Quote

Top Page

Messages In This Thread
problem with class method - by AmirAB - Feb-10-2019, 08:25 PM
RE: problem with class method - by buran - Feb-10-2019, 08:30 PM
RE: problem with class method - by snippsat - Feb-10-2019, 09:39 PM
RE: problem with class method - by AmirAB - Feb-13-2019, 01:51 AM

Possibly Related Threads...
Thread Author Replies Views Last Post
  calling on a method from one class into another class which is not a child NABA 5 168 Apr-29-2020, 07:49 PM
Last Post: deanhystad
  [split] Python Class Problem astral_travel 12 312 Apr-29-2020, 07:13 PM
Last Post: michael1789
  Python Class Problem JPCrosby 2 264 Apr-28-2020, 06:18 PM
Last Post: buran
  Class problem duckduck23 2 173 Feb-10-2020, 08:52 PM
Last Post: jefsummers
  Class code problem from CS Dojo YouTube Dixon 3 278 Feb-04-2020, 10:23 PM
Last Post: snippsat
  Problem with adding arbitrary parrameters to __init__ method sebastianvdn 1 193 Feb-03-2020, 09:30 PM
Last Post: micseydel
  Class Problem scratchmyhead 3 331 Nov-19-2019, 08:28 AM
Last Post: Larz60+
  threading for method outside class anna 0 165 Nov-17-2019, 07:05 AM
Last Post: anna
  how can I changing a base class method voidptr 2 216 Nov-10-2019, 10:53 PM
Last Post: voidptr
  How to Call a method of class having no argument dataplumber 7 725 Oct-31-2019, 01:52 PM
Last Post: dataplumber

Forum Jump:


Users browsing this thread: 1 Guest(s)