Passing Methods as Callables

Medium Method Types & Behaviors PRO
🔒 Login to Unlock

Problem Statement

Define a `Greeter` class with an instance method `say_hello(self)` that prints ‘Hello from method!’. Instantiate it, assign the method to a variable `func` (do not use parentheses), and then invoke `func()`.

Input Format

None

Output Format

Print the exact greeting.

Constraints

None

Sample Output

Hello from method!

Explanation

In Python, methods are objects themselves and can be passed around or assigned to variables just like standard functions.

Starter Code

class Greeter:
    # Define say_hello
    pass

if __name__ == '__main__':
    g = Greeter()
    # Assign method to func and call func()
    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