💡 For the best experience, set your browser zoom level to 75%

    ‎75%‎ للحصول على أفضل تجربة، اضبط مستوى تكبير المتصفح على 💡

Skip to main content

Lesson 13 - Assignment

Write a Python program that:

1.    Asks the user to input a number.

2.    Tries to divide 100 by that number using try-except.

o   Handle ZeroDivisionError and ValueError.

o   Use else to print the result if no exception occurs.

o   Use finally to print "Execution finished." no matter what.

3.    Use the raise keyword to raise an error if the number is negative.

4.    Format the final message using .format() to show the input and result.