У нас вы можете посмотреть бесплатно Python Function with Assertion and Exception Handling | VTU Q7 | 1BPLC105B или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Python Program Using Function, Assertion, and Exception Handling VTU Model Question Paper – 1BPLC105B (Question 7) In this video, I solve a Python programming question from the VTU Model Question Paper for the subject 1BPLC105B. Question (7): Develop a function named DivExp which takes two parameters a and b, and returns c = a / b. Write a suitable assertion for a greater than 0 in the function and raise an exception when b = 0. Develop a suitable program that reads two console values and calls the function DivExp. PYTHON SOLUTION USED def divexp(a, b): assert a greaterthan 0, "a must be greater than 0" if b == 0: raise ZeroDivisionError("b cant be 0") return a / b try: print("Result =", divexp(float(input("a: ")), float(input("b: ")))) except Exception as e: print("Error:", e) CONCEPTS COVERED Functions in Python Assertions Exception handling using try-except Raising exceptions ZeroDivisionError User input handling This video is useful for VTU students First year engineering students Python beginners Exam and viva preparation Like, Share, and Subscribe for more VTU Python programming lab solutions and exam-oriented tutorials.