Shift + Enter · ప్రారంభించండి / పునఃప్రారంభించండి
కోడ్ ప్రాంప్ట్ గైడ్ని చదవండి
- ప్రోగ్రామింగ్ లాంగ్వేజ్
- Python
- కష్టం
- మధ్యస్థం
Define a class with state and an increment method.
class Counter:
def __init__(self, start=0):
self.value = start
def increment(self):
self.value += 1
return self.value
counter = Counter(3)