Class Method: Using the @classmethod decorator

Medium Method Types & Behaviors
Solve in Playground →

Problem Statement

Create a `Counter` class with a class variable `count = 0`. Create a class method `increment(cls)` that increments `cls.count` by 1 and prints ‘Count: [count]’. Call it N times based on input.

Input Format

An integer N.

Output Format

Print the count at each increment.

Constraints

1 <= N <= 100

Sample Input

3

Sample Output

Count: 1
Count: 2
Count: 3

Explanation

Class methods take `cls` as the first argument and can modify class state that applies across all instances.

Starter Code

class Counter:
    count = 0
    
    # Define class method increment
    pass

if __name__ == '__main__':
    n = int(input())
    # Call increment n times
    pass

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used