Create a `Calculator` class with a method `divide(a, b)`. In the main block, read two integers, call the method inside a try-except block, catch Python’s built-in `ZeroDivisionError`, and print ‘Cannot divide by zero’.
Two space-separated integers.
Print the integer result (using int() cast) or the error message.
None
10 0
Cannot divide by zero
When an object's method performs an unsafe operation, the caller should wrap the invocation in a targeted except block.
class Calculator:
# Define divide method
pass
if __name__ == '__main__':
a, b = map(int, input().split())
# Instantiate and safely call divide
passEmbedded 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