Modifying Class State via Class Methods

Medium Method Types & Behaviors
Solve in Playground →

Problem Statement

Create a `Store` class with `store_name = “Default”`. Create a class method `set_name(cls, name)` to modify this class variable. Read a string, use the class method to update it, instantiate a store, and print ‘Store: [store_name]’.

Input Format

A single word string.

Output Format

Print the updated class variable.

Constraints

None

Sample Input

SuperMart

Sample Output

Store: SuperMart

Explanation

A class method modifies the class namespace, ensuring all instances share the updated value.

Starter Code

class Store:
    store_name = "Default"
    
    # Define class method set_name
    pass

if __name__ == '__main__':
    new_name = input().strip()
    # Update name, instantiate, and print
    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