Why does circumference require ()?

Why here need a () when I wrote print(medium_pizza.circumference())?
And since def init return none, why when I test print(medium_pizza.radius), it did return radius value? and why in there I don’t need a () after radius?

class Circle:
  pi = 3.14
  def __init__(self, diameter):
    print("Creating circle with diameter {d}".format(d=diameter))
    # Add assignment for self.radius here:
    self.radius = diameter / 2
  def circumference(self):
    self.circumference= 2 * self.pi * self.radius
    return self.circumference

medium_pizza = Circle(12)
teaching_table = Circle(36)
round_room = Circle(11460)

calling functions and methods require parentheses

init is a magic method, its automatically called when you create a new instance of a class. Within the init method, you can then declare the instance variable(s)

radius is instance variable, accessing variable, instance variable and class variables doesn’t require parentheses.


why in the test we wort the answer for Q 3 before Q 2 and when i answer 2 first it give me error that i need to define medium_pizza and i already did so i don’t understand this part

Q2 and Q3 are question 2 and question 3? If so, please share the exercise url, so i can have a look at the instructions of the lesson


Your code is correct, what is the problem? Of course to call a method on a class instance, you first need to create the class instance