Raising custom errors in Python | Python Tutorial - Day #38

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ย. 2024
  • Python is one of the most demanded programming languages in the job market. Surprisingly, it is equally easy to learn and master Python. This python tutorial for absolute beginners in Hindi series will focus on teaching you python concepts from the ground up.
    Access the Playlist: • Python for Beginners (...
    Link to the Repl: replit.com/@co...
    Join Replit the browser-based IDE used in this course - join.replit.co...
    ►Checkout my English channel here: / @programmingwithharry
    ►Instagram: codewithharry
    python, C, C++, Java, JavaScript and Other Cheetsheets [++]:
    Playlist: • Coding CheatSheets 🧾 b...
    ►Learn in One Video[++]:
    Python[15 Hr]: • Python Tutorial For Be...
    Python Advance[3.5 Hr]: • Python Programming Cou...
    Python[1 Hr]: • Learn Python In Hindi ...
    Python[2 Hr]: • Python Tutorial In Hin...
    Python[15 Min]: • 15 Minute Python Tutor...
    JavaScript[1 Hr]: • JavaScript Tutorial
    C[1.3 Hr]- • C Programming Tutorial...
    php[1 Hr]: • Learn Php In One Video...
    php[2.3 Hr]: • Php Tutorial for Begin...
    php[Project]- • Login And Registration...
    HTML[30 Min]: • HTML 5 Tutorial For Be...
    CSS[8.5 Hr]: • CSS Tutorial In Hindi ...
    CSS[1.4 Hr]: • CSS 3 Tutorial For Beg...
    Wordpress[3.2 Hr]: • How To Make a WordPres...
    Angular[2 Hr]: • Angular Tutorial in Hindi
    Java[2.3 Hr]: • Java tutorial in hindi 🔥
    Web Scraping[1 Hr]: • Web Scraping Tutorial ...
    MongoDB[2 Hr]: • MongoDb Tutorial For B...
    Numpy[1 Hr]: • Numpy Tutorial in Hindi
    Android Dev[12 Hr]- • Android Development Tu...
    Linux[1 Hr]: • Linux Tutorial For Beg...
    JQuery[1.1 Hr]: • jQuery Tutorial For Be...
    Git and GitHub[1.1 Hr]: • Git & GitHub Tutorial ...
    ►Complete course [playlist]:
    React: • React Js Tutorials in ...
    Python- • Python Tutorials For A...
    OOP Python- • Object Oriented Progra...
    Java: • Java Tutorials For Beg...
    JavaScript- • JavaScript Tutorials I...
    PHP- • PHP Tutorials in Hindi
    C- • C Language Tutorials I...
    C++- • C++ Tutorials In Hindi
    Git & GitHub- • Git and GitHub Tutoria...
    Android Dev- • Android Development Tu...
    Python GUI- • Python GUI: Tkinter Tu...
    Web Development- • Web Development Tutori...
    Python Django: • Python Django Tutorial...
    Projects Using HTML, CSS & Javascript- • Projects Using HTML, C...
    Data Structure and Algo: • Data Structures and Al...
    Follow Me On Social Media
    ►Website (created using Django Rest & Angular): www.codewithha...
    ►Facebook: / codewithharry
    ►Instagram: / codewithharry
    Twitter: / codewithharry
    Comment "#HarryBhai" if you read this 😉😉

ความคิดเห็น • 855

  • @jaideepawari7523
    @jaideepawari7523 ปีที่แล้ว +124

    This python course is helpful than all of those courses for paid!
    Jabardast Harry Bhai!

  • @Prachi-sc1he
    @Prachi-sc1he ปีที่แล้ว +103

    a = input("Enter the value butween 5 and 9: ")
    if (a == "quit"):
    print("ohk")
    elif (int(a) < 5 or int(a) > 9):
    raise ValueError("The number should be between 5 and 9")

    • @hnxpriyanshu
      @hnxpriyanshu ปีที่แล้ว +3

      Ye kaisa hai code hai run karke dekha kya

    • @PrashantKumar-kl5kk
      @PrashantKumar-kl5kk ปีที่แล้ว +5

      a=input("enter any number between 5-10 : ")
      if a=="quit":
      quit()
      a=int(a)
      if (a10):
      raise ValueError("u not entered vallide number")
      else:
      print(a)

    • @marialor2744
      @marialor2744 ปีที่แล้ว +6

      a = input("Enter the string only QUIET")
      if(a!="QUIET"):
      raise ValueError ("value Should be between 6 and 9")@@hnxpriyanshu

    • @hnxpriyanshu
      @hnxpriyanshu ปีที่แล้ว

      @@marialor2744 😂😂😅

    • @marialor2744
      @marialor2744 ปีที่แล้ว

      @@hnxpriyanshu 🤣🤣🤣🤣

  • @ChandniSingh-j4s
    @ChandniSingh-j4s ปีที่แล้ว +35

    a=input('Enter a number between 5 and 9: ')
    if (a=='quit'):
    exit()
    elif a.isalpha():
    print('Enter an integer value')
    elif ((int(a)9) ):
    raise ValueError('Entered value is not in between 5 or 9')
    elif((int(a)>=5) or (int(a)

    • @ndvlogs9732
      @ndvlogs9732 3 หลายเดือนก่อน +3

      great

    • @GoGetSP
      @GoGetSP 2 หลายเดือนก่อน

      It will show built-inerror when I type company12 as input

    • @chiranjitsarkar6303
      @chiranjitsarkar6303 2 หลายเดือนก่อน +1

      Replacing the last elif statement with else: would provide the same result.

    • @deepudadagaming4497
      @deepudadagaming4497 หลายเดือนก่อน +2

      a = input("enter number between 5-9 or enter quit for exit")
      if(a == "quit"):
      exit()
      elif(int(a) 9:
      raise ValueError(" You entered wrong input")

  • @educationedition
    @educationedition ปีที่แล้ว +19

    a = input("Enter any value between 5 and 9: ")
    try:
    if (int(a)9):
    raise ValueError("Value should be between 5 and 9")
    except:
    if a == str(a) and a !="quit":
    raise ValueError("Value should be between 5 and 9")

    print("code ended successfuly")

    • @sukhmanisingh4371
      @sukhmanisingh4371 ปีที่แล้ว

      Input value ko apne string me convert kiya uski jarurat nahi thi bro 🙌

    • @arpanadhikari6881
      @arpanadhikari6881 ปีที่แล้ว

      it's wrong. If you enter 2 or any other num, error won't be generated

    • @bharatiyarailbyaditya3526
      @bharatiyarailbyaditya3526 ปีที่แล้ว

      a=input("Enter any value: "
      If(a == quit):
      raise ValueError("Error 404")

  • @kaushikrajit5169
    @kaushikrajit5169 6 หลายเดือนก่อน +4

    Quick Quizz Question ->
    User = input("Enter The Value Between 5 And 9 : ")
    try:
    if (User == "Quit"):
    print("Better Luck Next Time!")
    else:
    if (int(User)>= 5 and int(User)

    • @kaushikrajit5169
      @kaushikrajit5169 5 หลายเดือนก่อน +1

      @@zameerkhan1306 Correct Hain lakin Yeh Quick Quizz Ka solution nahi hain yeh.
      Agar Mein "quit" likhte hu toh vo print kr jayega lakin agar mein koi integer pass krwata hu toh valueerror aa jayega

    • @owaiskhan4857
      @owaiskhan4857 หลายเดือนก่อน

      a=input("Enter Please")
      if a=='quit' or a== 'Quit':
      print("Yes")
      elif a.isnumeric():
      raise ValueError("Sorry enter quit")

  • @sjain950
    @sjain950 5 หลายเดือนก่อน +1

    for i in range(6):
    a = input("Please enter value between 5 to 9: ")
    try:
    if (a == "quit"):
    print("Comeback soon")
    elif (int(a) >= 5 and int(a)

  • @aitanuja9362
    @aitanuja9362 4 หลายเดือนก่อน +3

    a = input("Enter the value between 5 and 9 : ")
    if(a == "quite"):
    print("Thank You")
    elif(int(a)9):
    raise ValueError("The given item is invalid")
    print("Thank You
    Have a Great Day")

  • @arnabghosh9199
    @arnabghosh9199 ปีที่แล้ว +57

    a = input("Enter any value between 5 and 9 : ")
    if a == "quit":
    print("you choosed to quit")
    elif (int(a) < 5 or int(a) > 9):
    raise ValueError("Value should be between 5 and 9")

    • @arnabgoswami-bj6cl
      @arnabgoswami-bj6cl ปีที่แล้ว

      but if i type any other string , there is another error that is you converted a string into integer in elif statement

    • @azimshaikh179
      @azimshaikh179 ปีที่แล้ว +15

      @@arnabgoswami-bj6cl
      inpt = input("Enter an integer(between 5 and 9) : ")
      try :
      if inpt == "quit":
      print("no error")
      elif 5 < int(inpt) < 9:
      print(f"{inpt}")
      elif int(inpt) < 5 or int(inpt) > 9:
      raise ValueError("Sahi value daal bhai")
      except :
      print(f"please enter the either \"quit\" or the value between 5 and 9")

    • @UNOTech-ol4zo
      @UNOTech-ol4zo 9 หลายเดือนก่อน

      😁😁😁😁😂@@azimshaikh179

    • @UNOTech-ol4zo
      @UNOTech-ol4zo 9 หลายเดือนก่อน +4

      that sahi daal bhaii was personal 🤣

    • @mansishmahakul7718
      @mansishmahakul7718 8 หลายเดือนก่อน

      ​@@azimshaikh179I think in the 5th line, if you wrote
      elif 5 < int(float(inpt)) < 9:
      This will efficiently type cast.

  • @ami.12345
    @ami.12345 10 หลายเดือนก่อน +3

    a = input('enter any value between 5 and 10')
    if a == 'quit':
    print('no error ')
    elif 5 < a < 10:
    print('number are between 5 and 10')
    else:
    raise ValueError('value should be between 5 and 10')

  • @transylvanian1765
    @transylvanian1765 6 หลายเดือนก่อน +3

    a = input("Enter any value between 5 and 9. Write 'quit' to quit:")
    def myfuc():
    if a=="quit":
    print("program quitted")
    else:
    if(int(a)9):
    raise ValueError("Value should be between 5 and 9")
    else:
    print(a)
    myfuc()

  • @narendraade1027
    @narendraade1027 หลายเดือนก่อน

    a=input('Enter the value between 5 and9'l
    If(a==quit):
    Print("ohk");
    Elif("int (a)>=5or(int(a)

  • @01234567891984
    @01234567891984 ปีที่แล้ว +2

    a=input("Enter the value beetween 0 and 9 or quit for exit - ")
    string=str(a)
    for i in range(0,10):
    if a=="quit":
    break
    elif a!= "quit":
    a=int(a)
    if (a9):
    raise ValueError("the Value should be in 0 to 9")
    else:
    print(a)

    • @freefireplayer4212
      @freefireplayer4212 7 หลายเดือนก่อน

      we dont want same output 10 times

  • @abdullahbinshahzad
    @abdullahbinshahzad ปีที่แล้ว +7

    Here it is Sir:
    def run():
    user_input = input("Enter Value Between 5 and 9: ")
    try:
    if(user_input=='quite'):
    print('I am quite')
    elif(5>int(user_input)

    • @vatsalsharma4061
      @vatsalsharma4061 6 หลายเดือนก่อน

      this code is wrong :aise ValueError("Value must be 5>user_input)>9")
      there is no such no. thats less than 5 and greater than 9

    • @vatsalsharma4061
      @vatsalsharma4061 6 หลายเดือนก่อน

      this code in entirety is wrong

    • @vatsalsharma4061
      @vatsalsharma4061 6 หลายเดือนก่อน

      x=input("enter:")
      if(x.isnumeric()) :
      if(not 5

  • @virendrabeniwal958
    @virendrabeniwal958 ปีที่แล้ว +2

    a = input("enter any value")
    if a == str("viru"):
    print("sorry")
    else:
    try:
    if int(a) < 4 or int(a) > 9:
    print("enter a value between 4 and 9")
    elif int(a) >4 and int(a) < 9:
    print(a)
    except:
    print("sorry!")

  • @SamriddhiGupta-b5n
    @SamriddhiGupta-b5n 3 หลายเดือนก่อน +1

    a=input("enter b/w 5 and 9 or enter 'quit'")
    if(str(a)=='quit'):
    print(a)
    elif(5

  • @prashikmanwar1669
    @prashikmanwar1669 3 หลายเดือนก่อน +1

    a = input("enter a number between 5 and 9 : ")
    if a == "quit" :
    print("you chose to quit")
    elif int(a)9:
    raise ValueError("Number out of range.")
    elif int(a)>5 or int(a)

  • @coderistan
    @coderistan ปีที่แล้ว +8

    a= input("Enter a word")
    class CustomError(Exception):
    print("This is custom error")
    if(a=="quit"):
    print ("This word is \'quit\' ")
    else:
    raise CustomError("Word is unmatch")

    • @gtaburn7397
      @gtaburn7397 ปีที่แล้ว

      bhai class nhi padhai yrr abhi but code sahi hai ig

    • @5MinutesTrading878
      @5MinutesTrading878 7 หลายเดือนก่อน

      @@gtaburn7397 run kar k check kia..ye agr quit bhi likhey phir bhi custom error dey raha

  • @GhostMario0
    @GhostMario0 8 หลายเดือนก่อน

    print("here we make errors by ownself".upper())
    k1=input("enter the num between 5 and 9 , write quite
    ")
    if int(k1)>5 or int(k1)

    • @providencee-sports6454
      @providencee-sports6454 7 หลายเดือนก่อน

      i = input("Enter value betwwen 1 and 4: ")
      if i == "quit": #treat this as a try
      print("OK, program quited")
      elif int(i)>4 or int(i)

  • @mriditdas6516
    @mriditdas6516 28 วันที่ผ่านมา

    a = input("Enter any value between 5 and 9: ")
    if (a == "quit"):
    print("you quitted")
    exit()
    if (int(a)9):
    raise ValueError("value should be between 5 and 9")
    else:
    print("thanks for your input")

  • @harshitaTripathi58
    @harshitaTripathi58 ปีที่แล้ว +2

    a=input("enter a no.between 1 to 9")
    try:
    if int(a)>9 or int(a)

    • @animexworld6614
      @animexworld6614 6 หลายเดือนก่อน

      This code is not correct

  • @akash.19933
    @akash.19933 3 ชั่วโมงที่ผ่านมา

    alpha = input("enter the word quit :").lower()
    try:
    if alpha =="quit":
    print("you are all good")
    else:
    raise ValueError('value need to be only quit')

    except ValueError as er:
    print(er)

  • @argos03
    @argos03 11 หลายเดือนก่อน +3

    a = input("Enter num: ")
    try:
    if (int(a) < 0 or int (a)>5):
    raise ValueError("Enter valid input!")
    except:
    if (a!="quit"):
    raise ValueError("Enter valid input!")
    print("End")
    I'm late but tried my code and sucessfully executed

    • @dabilover444
      @dabilover444 10 หลายเดือนก่อน +1

      why did u write ! after a in if (a!="quit"):

    • @souvikdas811
      @souvikdas811 10 หลายเดือนก่อน

      It means "not equal to"@@dabilover444

  • @md.taahaabakhshi1812
    @md.taahaabakhshi1812 ปีที่แล้ว +5

    a=input("Enter value : ")
    if a== "quit":
    print("Executed")
    elif a!="quit":
    raise ValueError ("U enter wrong value")

    • @sachin_kaxhyap
      @sachin_kaxhyap 8 หลายเดือนก่อน

      a = input( " Enter any value between 5 and 9: ")
      if a == "quit":
      print("quitting program")
      exit()
      elif a < "5" or a > "9":
      raise ValueError( "Value should be between 5 and 9")

  • @debasmitamandal2076
    @debasmitamandal2076 4 หลายเดือนก่อน

    a=input("Enter any value between 5 and 9 : ")
    try:
    if(a=='quit'):
    print("you have quitted")
    elif (int(a)9):
    raise ValueError("Please enter value between 5 and 9.")
    else:
    print("You're good to go.")
    except Exception as e:
    print(f"Error is : {e}")

  • @adityapundir6529
    @adityapundir6529 ปีที่แล้ว +63

    Please make a video on freelancing

  • @Fact_with_Sarhak
    @Fact_with_Sarhak 4 หลายเดือนก่อน

    a = input("Enter a number:")
    if a == "quite":
    print("Program is quite")
    elif(int(a)9):
    raise ValueError("Value should be between 5 and 9")
    else:
    print("you choose the right number", a)

  • @BHARATSOLANKI-gy6ru
    @BHARATSOLANKI-gy6ru ปีที่แล้ว +1

    a=(input("Enter a number between 3 and 8: "))
    try:
    if a=="quit":
    print("str done")
    elif int(a)3:
    print("int done")
    except:
    raise ValueError("Invalid input")

  • @uafoundations
    @uafoundations ปีที่แล้ว +1

    a = input("Enter a number between 5 and 20: ")
    if a == 'quit':
    print("Program broken!")
    elif int(a)20:
    raise ValueError("The number should be greater than 5 and less than 20!")
    else:
    for i in range(1, 11):
    print(f"{int(a)}x{i}={int(a)*i}")

  • @rinilaha6125
    @rinilaha6125 ปีที่แล้ว +1

    a = input("Enter any value between 5 and 9")
    if (a=='quit'):
    print("this program is passed")
    else:
    (int(a)9 )
    raise ValueError("Value should be between 5 and 9")

  • @Negi171
    @Negi171 6 หลายเดือนก่อน

    a=input("enter a number between 5 and 9")
    try:
    if(a=="quit"):
    print("Input successfully recieved")
    elif(5>int(a)) or (int(a)>9):
    raise ValueError("invalid input")
    else:
    print("Input successfully recieved")
    except:
    print(f"please enter the either \"quit\" or the value between 5 and 9")

  • @devanshtanwar4075
    @devanshtanwar4075 3 หลายเดือนก่อน

    a = input("Enter any value between 5 and 9")
    if a.isnumeric():
    if int(a) < 5 or int(a) > 9:
    raise ValueError("Value should be between 5 and 9")
    elif a.isalpha():
    if a.lower() == "quit":
    print("Program ended")
    else:
    raise TypeError("Enter correct datatype")

  • @PranshuGoyal-cr8mm
    @PranshuGoyal-cr8mm ปีที่แล้ว +1

    a = input("Enter the value: ")
    if a == "quit":
    print()
    elif int(a)>5 and int(a)

  • @UtsavJasani-ri5cs
    @UtsavJasani-ri5cs 3 หลายเดือนก่อน

    av = input("enter the value between 5 and 10 (to quite write quit:) : ")
    if av.lower() == 'quit':
    print("you are quitting...........")
    else:
    try:
    a = int(av)
    if (a < 5 or a > 10):
    raise ValueError("please enter the value should be between 5 and 10")
    except ValueError as e:
    print(e)
    else:
    print(a)

  • @freefireplayer4212
    @freefireplayer4212 7 หลายเดือนก่อน

    i = 1
    while(i==1):
    i+=1
    a = (input("Enter any value between 5 and 9 : "))
    if a == "ij roy":
    print("You are a good boy")
    break
    a = int(a)
    if(a9):
    raise ValueError("Value should be between 5 and 9")
    print(f"You entered {a}")

  • @komalnagori280
    @komalnagori280 4 หลายเดือนก่อน

    a=input("Enter any nymber btw 3 to 9: ")
    if(a=="quit"):
    print(" ")
    try:
    if(int(a)>9 or int(a)

  • @CodingHood
    @CodingHood ปีที่แล้ว +1

    print("
    ")
    i = input("Write Here : ")
    if i == "quit":
    print("Successfully Quit")
    else:
    if (int(i) < 10 or int(i) > 20):
    raise ValueError("Value should be between 10 and 20")
    THANK YOU FOR THIS AMAZING QUIZ 😍😍😄😄 ❤❤

  • @SuNnY27796
    @SuNnY27796 2 หลายเดือนก่อน

    a = input("Enter any value between 5 and 9 or \"quit\": ")
    if a == "quit":
    print("Thank you!")
    elif a.isalpha():
    raise ValueError("Invalid input! Value should be between 5 and 9")
    else:
    a = int(a)
    if 5

  • @anvrag
    @anvrag ปีที่แล้ว +21

    while True:
    input_ = input("enter a number between 7 and 15 (enter q or quit): ").lower()
    if input_ == "q" or input_ == "quit":
    print("thank you")
    break
    try:
    num = int(input_)
    if 7

    • @Nothing-78646
      @Nothing-78646 2 หลายเดือนก่อน +1

      can you explain me that how the again and again play game function is working if we print yes in last....how he knows that yes mean start the function again...kindly reply

    • @biswajeet9826
      @biswajeet9826 2 หลายเดือนก่อน

      @@Nothing-78646 because of the while true part

    • @biswajeet9826
      @biswajeet9826 2 หลายเดือนก่อน

      while True:
      input_ = input("enter a number between 7 and 15 (enter q or quit): ").lower()
      if input_ == "q" or input_ == "quit":
      print("thank you")
      break
      try:
      num = int(input_)
      if num < 7 or num > 15:
      raise ValueError("the number should be between 7 and 15")
      print(f"the answer is {num}")
      except ValueError as e:
      print(e)
      except TypeError:
      print("you entered an invalid string")
      finally:
      play_again = input("Do you want to play again? (yes/no): ").lower()
      if play_again != "yes":
      print("Thank you for playing.")
      break
      print("Let's play again!
      ")

  • @jacksparrow-bz1kj
    @jacksparrow-bz1kj ปีที่แล้ว

    a=input('enter integer ')
    if (a=='quit'):
    print('yes, you quit this programme')
    elif(int(a)9) :
    raise ValueError("you must enter 5-9 integer ")
    else:
    print('done, value accepted 😊')

  • @mohdrayees8919
    @mohdrayees8919 ปีที่แล้ว +4

    Harry sir i have tried this one:
    a = (input("Enter any value between 5 and 9 : "))
    if(a=="quit"):
    print("User has quit the program")
    elif(str(5)

    • @unibyte09
      @unibyte09 ปีที่แล้ว

      use and*
      str(5) < a and a < str(9)

  • @gamestofame254
    @gamestofame254 หลายเดือนก่อน

    a=input("enter a number between 5 and 9")
    if a=="quit":
    print("ok")
    elif(a.isalpha()==True):
    raise TypeError("Its not a integer literal")
    elif(int(a)>5 and int(a)

  • @ZenQuotes1
    @ZenQuotes1 หลายเดือนก่อน

    a = (input('Value between 5 and 9 : (or type "quit" to exit): '))
    if(a.lower()=='quit'):
    print('Program Quit')
    elif(int(a)9):
    raise ValueError('Value should be between 5 and 9')
    else:
    print('Value is : ',a ,'Thanks for correct input')

  • @Fun-xz5zd
    @Fun-xz5zd ปีที่แล้ว +16

    a = input ("Enter any number value between 5 and 9 or enter quit
    >>")
    try:
    if (int(a)9):
    raise ValueError("The number is either lesser than 5 or bigger than 9")
    except:
    if a!= "quit":
    raise ValueError ("You entered a string other than quit")

    • @shammermustafa52
      @shammermustafa52 ปีที่แล้ว

      noooooooooooooooooooooooooooo

    • @HexFireGaming1
      @HexFireGaming1 ปีที่แล้ว

      👍

    • @rampalsahni730
      @rampalsahni730 ปีที่แล้ว +1

      Bro ek baat input me out of range no. Dal ke dekho error except ka aayaga

    • @GolluGaming
      @GolluGaming ปีที่แล้ว

      bro ,,, if (int(a)9) ,,, isme or operator use hoga

  • @asthakumari3602
    @asthakumari3602 2 หลายเดือนก่อน

    a=input("enter a number btw 5 to 9:-")
    if (a.lower()=="quit"):
    print("you quit!!")
    elif (5

  • @GreenEyed_Vlogs
    @GreenEyed_Vlogs ปีที่แล้ว

    a=input("Enter the value btwn 5 and 9- ")
    try:
    if a.lower()=="quit":
    print("Program ends here")
    else:
    if int(a)>5 and int(a)

  • @UdakshuShorts
    @UdakshuShorts ปีที่แล้ว +1

    a = input("Enter any value between 5 and 9 or quit")
    if a == "quit":
    print("quitted")
    elif a == "6" or a == "7" or a == "8":
    int(a)
    print(f"it's {a}")
    else:
    raise ValueError(
    "it's an invalid value please enter value between 5 and 9 or quit")

  • @minecraftcookie2929
    @minecraftcookie2929 ปีที่แล้ว

    print("Enter any value between 5 and 9: ",end = '')
    a = input()
    if(a == "quit"):
    pass
    elif(int(a) < 5 or int(a) > 9):
    raise ValueError("Value out of bounds !!!")

  • @mohammadtayyab525
    @mohammadtayyab525 4 หลายเดือนก่อน

    a=(input("Enter any value between 5 and 9: "))
    if (a=="quit"):
    print("You chose to quit!")
    elif(int(a)9):
    raise ValueError("You entered the name out of range.")
    else:
    print(a)

  • @bhuvandevarshetty1708
    @bhuvandevarshetty1708 7 หลายเดือนก่อน

    a = input("enter the value between 5 and 9:")
    if (a.lower()=="quit"):
    print(a.lower())
    elif(int(a)9):
    raise ValueError("value should be between 5 and 9")
    else:
    print(a)

  • @gauravpawar2993
    @gauravpawar2993 ปีที่แล้ว +1

    a=(input("enter your answer:"))
    if(a=="quit"):
    print("quit")
    elif(int(a)10):
    raise ValueError("value error")

    • @NavnitGujjar007
      @NavnitGujjar007 7 หลายเดือนก่อน

      this will show an error

  • @raghavkapoor9481
    @raghavkapoor9481 ปีที่แล้ว +9

    a = input("Kindly enter an integral value between 5 and 10: ")
    if a == "quit":
    print("
    No problem. Thanks for you time.")
    else:
    if (int(a)>9 or int(a)

    • @abdullahbinshahzad
      @abdullahbinshahzad ปีที่แล้ว

      Do you try Raghav as a string it must be raise error if any string other than the quite is enter

  • @biswajeet9826
    @biswajeet9826 2 หลายเดือนก่อน

    while True:
    a = input("Enter the value butween 5 and 9: ")
    if (a == "quit"):
    print("ohk")
    break
    elif (int(a)>=5 and int(a) 9:
    raise ValueError("The value should be between 5 and 9")
    print(f"The number {num} is within the range.")
    except ValueError as e:
    print(e)

  • @rishabhmalhotra6356
    @rishabhmalhotra6356 7 หลายเดือนก่อน

    a = input("Enter any value between 5 and 9")
    try:
    if (int(a)9):
    raise ValueError("Value should be between 5 and 9")
    except:
    if(a=="quit"):
    print("quit")
    elif type(a)==str:
    raise TypeError("Value should be an integer")
    print(f"your entered no {a} has been accepted")

  • @Shinzo4697
    @Shinzo4697 หลายเดือนก่อน

    perfect code under this quick quiz:-
    a=input("enter a no. between 5 and 9:")
    try:
    if a=="quit":
    print("No error")
    quit()
    elif a.isalpha():
    raise ValueError("Please enter a no not a string")
    b=int(a)
    if b9:
    raise ValueError("No should be between 5 and 9")
    except Exception as e:
    print(e)

  • @manoor0858
    @manoor0858 2 หลายเดือนก่อน

    a=input("Enter a number:
    ")
    if a=="quit":
    print("NO ERROR")
    exit()
    elif(a.isalpha()):
    print("Enter an integer")
    elif(int(a)9):
    raise ValueError("Enter number between 5 and 9")
    else:
    print(("Entered number is between 5 and 9"))

  • @huzaifarehan3914
    @huzaifarehan3914 7 หลายเดือนก่อน

    a=input("Enter value between 5 to 9: ")
    if (a == "quit"):
    print("you Quit")
    elif(int(a)9):
    raise ValueError("Value is not between 5 to 9")
    else:
    print(a)

  • @tigerofmountains2329
    @tigerofmountains2329 ปีที่แล้ว +1

    a = (input("enter value between 5 and 9 or enter quit"))
    if a == "quit" :
    print()
    elif (a9 ):
    raise ValueError("Value is should be between 5 and 9 or quit)

  • @AmitKumar-ej1hn
    @AmitKumar-ej1hn ปีที่แล้ว

    a=(input("Enter the value between 1 to 11"))
    if(a==int()):
    if(int(a)int(11)):
    raise inputerror("Input should be between 1 to 11.")
    elif(a=="quite"):
    print("Exiting the program")
    else:
    print("The input is :",a)

  • @AbdulazizUjjan-g7o
    @AbdulazizUjjan-g7o 2 หลายเดือนก่อน

    # raising custom error in case of any problem
    def error(in):
    if(in =="quit"):
    print(f"ok I am {in}")
    elif(in9):
    raise ValueError("value should be between 5 and 9")
    return 1
    i = input("enter the choice")
    error(i)
    love you harry bhai

  • @riyazahmadmulla2716
    @riyazahmadmulla2716 3 หลายเดือนก่อน

    a=input(("enter the value between 5 and 9
    "))
    try:
    a=int(a)
    if(a9):
    raise ValueError("value should be between 5 and 9")
    except Exception:
    if a=="quit":
    pass
    elif a!="quit":
    print("value should be between 5 and 9")
    print("end of program")

  • @moni3104
    @moni3104 ปีที่แล้ว +2

    X= input("enter the quit string ")
    For i in quit :
    If i ==Q :
    Break
    Raise Valueerror("you have entered capital Letter ")

    • @zeeshan4831
      @zeeshan4831 ปีที่แล้ว

      Jani jab condition he true nai to loop break kaysa ho ga??

  • @__idyllist
    @__idyllist 6 หลายเดือนก่อน +1

    a = input("Enter the number you want:")
    try:
    if a == "quit":
    print("The only string which is valid")
    print(a)
    elif int(a) < 5 or int(a) > 9:
    raise ValueError("The value doesn't suit the given expected range")
    except ValueError as e:
    print(e)

    • @vatsalsharma4061
      @vatsalsharma4061 6 หลายเดือนก่อน

      wrong try lol as input your programme will fail

    • @vatsalsharma4061
      @vatsalsharma4061 6 หลายเดือนก่อน

      x=input("enter:")
      if(x.isnumeric()) :
      if(not 5

    • @__idyllist
      @__idyllist 6 หลายเดือนก่อน

      @@vatsalsharma4061 copy and run it first

    • @__idyllist
      @__idyllist 6 หลายเดือนก่อน

      ​@@vatsalsharma4061a = input("Enter the number you want:")
      try:
      if a == "quit":
      print("The only string which is valid")
      print(a)
      elif int(a) < 5 or int(a) > 9:
      raise ValueError()
      except ValueError as e:
      print("Error",e)

    • @vatsalsharma4061
      @vatsalsharma4061 6 หลายเดือนก่อน

      @@__idyllist ok right

  • @jj........5587
    @jj........5587 ปีที่แล้ว +1

    a=input("enter QUIT in small letters: ")
    d="quit"
    if (a==d):
    print("ok")
    else:
    raise valuerror("please check the input")

  • @vishalgoswami6334
    @vishalgoswami6334 หลายเดือนก่อน

    a = input("Enter a number: ")
    try:
    if(a == "quite"):
    print("quiting the programme")
    elif(int(a)>5 and int(a)

  • @ChillYT01
    @ChillYT01 3 หลายเดือนก่อน

    quick quiz solution :-
    n=input("Enter number between 5 to 10 : ")
    if(n=="quite"):
    print("quite")
    elif(int(n)>10 or int(n)

  • @MrMhd-vg2nn
    @MrMhd-vg2nn 6 ชั่วโมงที่ผ่านมา

    a = (input("Enter the num between 5 and 9: "))
    if (a =="quit"):
    exit()
    a = int(a)
    if (a9):
    raise ValueError("you not entered valid number")
    else:
    print(a)
    date : 20-09-2024

  • @AtharvBhalke
    @AtharvBhalke 7 หลายเดือนก่อน

    a=(input("Enter any value between 5 & 9: "))
    if(a=="quit"):
    print("dalal")
    elif(int(a)9):
    raise ValueError("BKL 5 or 9 ke beech me daal")

  • @lakshayraj2403
    @lakshayraj2403 4 หลายเดือนก่อน

    a = input('enter number b/w 5 and 9 ')
    if a == 'quit':
    print('ok')
    else:
    a = int(a)
    if (a9):
    raise ValueError('number should be between 5 and 9')
    else:
    print('restart')

  • @ADITYAKUMAR-nq1um
    @ADITYAKUMAR-nq1um 8 หลายเดือนก่อน +1

    a=(input("Enter a number between 5 and 9:"))
    if( a=='quite'):
    print("right input!")
    elif(a'9'):
    raise ValueError("Invalid Inputs!")
    else:
    print("Do nothing")

  • @blankkartik8951
    @blankkartik8951 ปีที่แล้ว

    a =(input("Enter your number : "))
    if ("quit") in a:
    print("Program has been ended!")
    elif(int(a)>3 and int(a)

  • @TasinIslam-mc2dk
    @TasinIslam-mc2dk 9 วันที่ผ่านมา

    11.09.2024 day 38 is done.
    a = input("Enter any value between 5 and 9")
    if(a == "quit"):
    print("no error")
    elif 5 < int(a) < 9:
    print("nuber are between 5 and 9")
    else:
    raise ValueError("Value should be between 5 and 9")

  • @moviegod1390
    @moviegod1390 5 หลายเดือนก่อน

    try:
    a=(input("enter the value of a"))
    if a == "quit":
    print('you choosed to quit')
    elif int(a)9:
    print("you have entered an correct number")
    except:
    print("some error has occured")

  • @Ammad_Younas
    @Ammad_Younas ปีที่แล้ว

    a = input("Enter bw 5 and 9: ").lower()
    if a == "quit":
    print("Quitting...")
    elif a.isdigit():
    if (int(a)9):
    raise ValueError("Should be between 5 and 9")
    else:
    print("You are good to go!")
    else:
    raise ValueError("Only quit is acceptable!")

  • @girishfury2630
    @girishfury2630 8 หลายเดือนก่อน

    with custom exception name
    class stringerror(Exception):
    pass
    word = input("Type any word : ")
    def string_check(word):
    required = "quit"
    index = word.find(required)
    if index == 0 and word.islower():
    print (f"Congrats !! This is correct {word} you have entered")
    else:
    raise stringerror ("Try to enter the required quit in smaller case")
    string_check(word)

  • @preetheshpoojary3611
    @preetheshpoojary3611 11 หลายเดือนก่อน

    a = str(input("Enter any value between 5 and 9"))
    if((a'9') and a!="quit"):
    raise ValueError("Value should be between 5 and 9")

  • @ashokgaikwad3814
    @ashokgaikwad3814 11 หลายเดือนก่อน

    a=str(input("enter the number:"))
    s="quit"
    b=input("enter the number2:")
    sum=a+b
    if a==s:
    print(a+b)
    elif sum

  • @khemchand494
    @khemchand494 ปีที่แล้ว +22

    In this video lecture, we learnt about the raising custom errors using raise keyword. Sometimes, we want to impose hard and fast regulations so, we can use customer errors if something violates those regulations so, that it does not create any problem later in the program execution and that error can be handled at that point of time only. In the previous videos, we learnt about how to handle errors using exception handling with try, except and finally blocks. We can also make our custom error classes using any base case error with our defined set of rules to raise that error whenever it violates those rules.

    • @Aditya-jo1of
      @Aditya-jo1of ปีที่แล้ว

      pucha kisine?

    • @DivitMukhi
      @DivitMukhi ปีที่แล้ว

      LOL 🤣@@Aditya-jo1of

    • @VarshaSorout-vj9is
      @VarshaSorout-vj9is ปีที่แล้ว

      😂😂@@Aditya-jo1of

    • @VarshaSorout-vj9is
      @VarshaSorout-vj9is ปีที่แล้ว

      hm python video ni dkhinge tu hi pdha d commnts m......kuch b bkchdi😒😒😒🖕

    • @khemchand494
      @khemchand494 ปีที่แล้ว +1

      @@VarshaSorout-vj9is Are nhi bro, vo tho bs apne yaad rkhne ke liye comments Kiya tha

  • @surajbera1882
    @surajbera1882 10 หลายเดือนก่อน

    a = input("Enter any value between 5 and 9: ")
    try:
    if(a=="quit"):
    print("As You've chose to quit the program it is ended")
    elif(int(a)9):
    raise ValueError("Value should be between 5 and 9 ")
    else:
    print("Value Accepted")
    except ValueError:
    print("No Characters or Special Symbols are allowed")

  • @Goosebumpstaleshindi
    @Goosebumpstaleshindi 5 หลายเดือนก่อน

    a = input("Enter the value between 5 and 9: ")
    while True:
    try:
    if (a == "quit"):
    print("ohk")
    break
    elif 5

  • @soumyadipghosh4896
    @soumyadipghosh4896 2 หลายเดือนก่อน

    n = input("Enter the number for multiplication table : ")
    if n == "quit":
    print("Progarm End.")
    exit()
    try:
    if int(n)6:
    raise ValueError
    else:
    print(f"The Multiplication table of {n} is ----")
    for i in range(10):
    print(f"{n} X {i+1} = {int(n)*(i+1)}.")
    except ValueError:
    print("Enter a valid number!!!")

  • @adityasudan2876
    @adityasudan2876 3 หลายเดือนก่อน +1

    a = input("Enter a number between 5 and 9 - ")
    def hi():
    try:
    if int(a)9:
    return 1
    except:
    if a.lower() == 'quit':
    print("Okay")
    exit()
    x=hi()
    if x==1:
    raise ValueError("Galat hai kuch")
    else:
    print("Fine")
    SIMPLE AND EASY CODE

  • @AmbreenMahoor
    @AmbreenMahoor ปีที่แล้ว

    a = input("enter a value :")
    b = 'quit'
    if a == b:
    print(b)
    elif (a>5 or a

  • @abhishekmeena4253
    @abhishekmeena4253 ปีที่แล้ว

    a = input("enter value between 5 and 9: ")
    if a=="quit":
    print("a")



    elif(int(a)9 ):
    raise ValueError("value should be between 5 to 9")

  • @nothing-jr9yu
    @nothing-jr9yu หลายเดือนก่อน

    a = input('?')
    if(a == 'quit'):
    exit()
    #return 0
    if(int(a)

  • @mustak_085
    @mustak_085 7 หลายเดือนก่อน +1

    Add little more -------------------->
    a = input("Enter a number between 5 and 8: ")
    num = 0
    if a == 'quit':
    print("Good by!!")
    exit(1)
    try:
    num = int(a)
    except ValueError:
    raise ValueError("Given value must be a number")
    if 5 < int(num) > 9:
    raise ValueError("Value must be between 5 and 8")
    print("Success")

    • @xstrangesmod3922
      @xstrangesmod3922 5 หลายเดือนก่อน

      i succed your code
      a = input("Enter a number between 5 and 8: ")
      if a == 'quit':
      print("Good by!!")
      exit(1)
      try:
      a = int(a)
      except ValueError:
      raise ValueError("Given value must be a number")
      if int(a)8:
      raise ValueError("Value must be between 5 and 8")
      print("Success")

  • @ashishlatwal7917
    @ashishlatwal7917 10 หลายเดือนก่อน

    a = input("Enter an integer(between 5 and 9) : ")
    if a == "quit":
    print("Works")
    elif 5 < int(a) > 9:
    raise ValueError("Please enter correct value")

  • @hariharkadam1510
    @hariharkadam1510 ปีที่แล้ว +1

    num = input('enter num:')
    if num == 'quit':
    print('okay!')
    elif int(num) 5:
    raise ValueError('enter the num between 1 to 5')

  • @Emoteplayz
    @Emoteplayz 7 หลายเดือนก่อน

    quiz is done sir
    # quit - Write a program to print quit only
    a = input("Enter a word quit will be executed: ")
    if (a == "quit"):
    print("Quit is print")
    else:
    raise ValueError("Quizt is not ")

  • @Bappaqoutes
    @Bappaqoutes 2 หลายเดือนก่อน

    class five_div(Exception):
    pass
    try:
    a = int(input("Enter a: "))
    b = int(input("Enter b: "))
    if b == 0:
    raise ZeroDivisionError("Can't divide by Zero!")
    elif b == 5:
    raise five_div("Can't divide by five!")
    else:
    print(a/b)
    except (ZeroDivisionError,five_div) as e: #handling multiple exceptions in one single except block
    print(e)
    except: #except of exception class
    print("Error occured check your input!")
    else:
    print("All good!")
    finally:
    print("Program executed!")
    Thanks !!

  • @Nood.khiladi
    @Nood.khiladi 3 หลายเดือนก่อน

    a = input("enter your number between 5 and 9:")
    if a== "quit":
    print("you are quit")
    elif(int(a)9):
    raise ValueError("value Between 9 or 5")

  • @vegetable1444
    @vegetable1444 7 หลายเดือนก่อน

    p=(input('enter your input-'))
    if p=='quit':
    pass
    else:
    if(int(p)9):
    raise ValueError('value should be between 5 and 9')
    else:
    print('no error')

  • @swagatamajumder9471
    @swagatamajumder9471 ปีที่แล้ว

    a= input("enter a number (should be from 5 to 9)
    or to Exit type 'quit'

    ")
    if(a=='quit'):
    print("exited
    ")
    elif(a!='quit' and a.isalpha() ):
    raise ValueError("enter integer only
    ")
    elif(int(a)9 ):
    raise ValueError("value should be from 5 to 9
    ")
    else:
    print(f"the square of the number is: {int(a)**2}
    ")
    print("thank you")

  • @vireshgupta1925
    @vireshgupta1925 ปีที่แล้ว

    a=input("enter any number between 5 to 9:-")
    if(a=="quit"):
    print("ohk")
    elif(int(a)9):
    raise ValueError("invalid input")
    else:
    print("valid input")

  • @aryankushwaha9306
    @aryankushwaha9306 4 หลายเดือนก่อน

    a = input("Enter the number: ")
    if a == "QUIET":
    print("QUIET")
    else:
    a = int(a)
    if a < 5 or a > 9:
    raise ValueError("Value should be between 5 and 9")

  • @codedByAyush
    @codedByAyush 6 หลายเดือนก่อน

    num = input("Enter any value between 5 and 9: ")
    if num == "quit":
    print("Program quited")
    else:
    if num.isdigit():
    if (int(num) >= 5 and int(num)

  • @sachin_kaxhyap
    @sachin_kaxhyap 8 หลายเดือนก่อน

    9:11
    a = input( " Enter any value between 5 and 9: ")
    if a == "quit":
    print("quitting program")
    exit()
    elif a < "5" or a > "9":
    raise ValueError( "Value should be between 5 and 9")

    • @sachin_kaxhyap
      @sachin_kaxhyap 8 หลายเดือนก่อน

      @GamersDen2 It's just muscle memory for me. My brain automatically added exit function.
      And
      suppose you have more code after the elif statement you want to execute if 'elif' is true then you need to add 'exit()' in 'if' statement.

  • @TheFactBoii
    @TheFactBoii 11 หลายเดือนก่อน +5

    finally aaj bhai ki hoodie change ho hi gayi😂😂

  • @MuhammadAbubakar-ev5jz
    @MuhammadAbubakar-ev5jz ปีที่แล้ว

    a=input("enter the value:")
    class CustomError(Exception):
    print("this is custom error ")
    if(a=="quit"):
    print("the value is \"quit\"")
    else:
    raise ValueError("the text is wrong")

  • @Md_Shaaz
    @Md_Shaaz หลายเดือนก่อน

    with Or we can put number of between we should change if condition to if(5

  • @0001omkarpatil
    @0001omkarpatil 4 หลายเดือนก่อน

    def checkval():
    while True:
    a=input("enter value")
    if(a=='quit'):
    print("you quit")
    break
    try:
    a=float(a)
    if(a>9 or a