[Hindi] Try, Except, Else and Finally in python explained | Advanced python tutorials in Hindi

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

The best explanation of exception handlers. Keep up the good work!

resai
Автор

one example
import random
a=random.randint(1, 20)
while(True):
try:
n=int(input("Enter a number between 1 to 20: "))
if a==n:
print("YOU GOT!!")
break
except Exception as e:
print(e)
else:
print("sorry!! try again")

pijushmondal
Автор

lots of thanks @Harry bhai, wonderful!

sonamjorphail
Автор

Thanks Harry Bhai...For This Explanation ❤️

iamaniketkr
Автор

Harry Bhai, what is he difference between writing code in finally block and writing the code out of the indentation ?

try:
print("Try block hai")
except Exception as error:
print(f"{error} aa gaya hai Bhai...")
else:
print("error nai aaya, sab jhakas hai")
finally:
print("iska samajh nahi aaya Harry Bhai")

print("Ye wali line aur finally block k andar ke code me kya difference hai Harry Bhai ??")

KaladharGopal
Автор

When I see in upper screnn error I shocked 😲 bcz mene abhi Naya folder dalwaya hai

revivingfaith
Автор

Good explain. I.A.Siddiqui Karachi PAKISTAN

ishtiaqahmad
Автор

Could you explain why we are using else? if exception don't occur we can write the code in Try as well

tanhapatel
Автор

What if the code in finally will throw error ?

alkgupta
Автор

Kya koyi finally ka use bata payega kisaliya hum finally ka use karate hai

shubhamganjare
Автор

Bhaii try ke sath else wala kyu chala ga

Zoroa