Тёмный

Exception Handling in Python 

Nuruzzaman Faruqui
Подписаться 16 тыс.
Просмотров 310
50% 1

In case of any error occurs, Python interpreter stops the program execution and generate an error message. Using ‘try except’ block, we can prevent the program execution interruption by avoiding the error moving on to a designated part of the program. This approach is called exception handling. In this lesson, we will learn how to handles error in Python in ‘try error’ blocks.
The Python code used in this lesson:
try:
celsius = int(input("Temperature in Celsius: "))
fahrenheit = (celsius * (9/5)) + 32
print(fahrenheit)
print(f"F to C ratio (F/C): {fahrenheit/celsius}")
except ValueError:
print('Invalid input')
except ZeroDivisionError:
print('Celsius cannot be 0')
‘You are free to copy, edit, use and distribute this code without crediting the author. Enjoy copyright-free content.’ - Nuruzzaman Faruqui.

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 2   
@choudhryumarsaeedwarraich7929
@choudhryumarsaeedwarraich7929 3 года назад
V.Nice Video
@NuruzzamanFaruquis
@NuruzzamanFaruquis 3 года назад
Thank you.
Далее
Classes in Python
7:07
Просмотров 451
Function in Python
11:11
Просмотров 458
Вопрос Ребром - Серго
43:16
Просмотров 1,2 млн
AsyncIO, await, and async - Concurrency in Python
9:12
Diabetes Prediction using Deep Learning
20:13
Просмотров 6 тыс.
If __name__ == "__main__" for Python Developers
8:47
Просмотров 405 тыс.
Python Decorators in 15 Minutes
15:14
Просмотров 444 тыс.
Python Constructor
5:41
Просмотров 3 тыс.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
Please Master These 10 Python Functions…
22:17
Просмотров 167 тыс.
Dictionary in Python
4:02
Просмотров 272