#Author: James Tam #Version: November 2, 2024 #Learning objective: #*How the finally construct works: it is coded poorly for learning purposes # just to prove that the finally body always executes i.e. the function tries def fun(): numerator = float(input("Number to divide: ")) denominator = float(input("Value to divide by: ")) try: quotient = numerator / denominator except ZeroDivisionError: print("Cannot divide by zero") return() #Extremely bad style included only for learning purposes else: print("Quotient=%0.2f" %(quotient)) return() #Extremely bad style included only for learning purposes finally: print("This message always appears") def start(): fun() print("After fun") start()