Advanced Python Series- Custom Exception Handling In Python

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 30

  • @freebeast3790
    @freebeast3790 5 місяців тому +2

    for any of you having doubt like me that why do we create a custom class , well not all errors fall in value error , index error etc. like the dob case above , so we created a new one

  • @keenzeen
    @keenzeen 2 роки тому

    I am a beginner and I say your content are awesome. The way you explain is super brain friendly. ❤❤

  • @sakshampandit1335
    @sakshampandit1335 2 роки тому +5

    Sir you made a mistake in if condition while checking the age , "&" must be replaced by "and".

  • @anishamalblanco7386
    @anishamalblanco7386 3 роки тому

    class Error(Exception):
    pass
    class emailException(Error):
    pass
    class customgeneric(Error):
    pass
    email= str(input("Enter your email "))
    try:
    if '@' in email:
    print("Email is valid")
    else:
    raise emailException
    except emailException:
    print("Your email needs to have @")
    This is an example of a email validation with exception handling.

  • @MuhammadShahzad-dx5je
    @MuhammadShahzad-dx5je 4 роки тому +2

    Thanku so much Krish sir

  • @RohitKumar-dg2qt
    @RohitKumar-dg2qt 2 роки тому +1

    Hi krish, I am currently on this video. and when i use even year (say 2022 or 2024) then the try block is skipping and only except is running even when the age is in valid range. any help please?

    • @killmastergaming3939
      @killmastergaming3939 2 роки тому

      Dude because these are greater than 2021...hence your age will be negative...and they will go in the exception case...any age except btween 20 and 30 will go to the exception case

    • @poojitadagar
      @poojitadagar Рік тому

      its because he's used bitwise operator, instead use 'and'... it will work fine

  • @varanasijagadeesh5619
    @varanasijagadeesh5619 4 роки тому +1

    Sir, how can we give correct input value again by knowing the exception error of the past entry.

    • @Tussu17
      @Tussu17 3 роки тому

      You can use While loop. Like this..
      class DateOfBirthError(Exception):
      def __init__(self,error = ""):
      self.doberror = error
      def __str__(self):
      return self.doberror
      while True:
      age = int(input("Enter your age: "))
      try:
      if age >= 18 and age

  • @Nalla_GameShow
    @Nalla_GameShow 3 роки тому

    Hey Kris why you make the class of Error and dobException ?? This can be done directly done in try and except

  • @louerleseigneur4532
    @louerleseigneur4532 3 роки тому

    Thanks Krish

  • @ankit24101
    @ankit24101 4 роки тому +2

    Can you please put a video of using big data in image recognition of cnn or any other project :- i want to learn using big data in ML

  • @Axl124124
    @Axl124124 2 роки тому

    Is there a way to return an empty list if you get a certain exception?

  • @pratikkhairnar1512
    @pratikkhairnar1512 4 роки тому +2

    Hello I am a working Mechanical Engineer.
    Wanted to be a Data Scientist.
    I have started learning Python.
    What should be my strategy for next 6 to 8 months ?

  • @Tussu17
    @Tussu17 3 роки тому +1

    It's not a good idea to use bitwise operator & instead use 'and'.

  • @smartemitra7594
    @smartemitra7594 4 роки тому +1

    sir please make video on object detection, bert, vgg16

  • @bharatkori659
    @bharatkori659 Рік тому

    i never understood this easy.

  • @adityatiwary3022
    @adityatiwary3022 4 місяці тому +1

    💜💜💜💜💜

  • @brandonjonathan6654
    @brandonjonathan6654 4 роки тому +2

    So Nice 💘💘💘💘💘💘

  • @Abhishekkumar-jr7qt
    @Abhishekkumar-jr7qt 4 роки тому +2

    sir , can you please help in this topic " Predictive analytics for social networks" . it is my final year project. please sir it my request to help me on this topic that what can i do in this..

  • @shreyasb.s3819
    @shreyasb.s3819 3 роки тому

    Good info

  • @rahyousuff
    @rahyousuff 3 роки тому +10

    It should be "and " rather than "&"

    • @mohammedcementwala5657
      @mohammedcementwala5657 3 роки тому +1

      thank you so much for your help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      was stuck badly due to this error

  • @adityapathania3618
    @adityapathania3618 3 роки тому

    Check why 2020 born are getting the error ?

  • @indirajithkv7793
    @indirajithkv7793 2 роки тому

    ❤✨