GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Python : Dealing with Errors

Briache Issam Englisch

Python : Dealing with Errors

Inhalt der Mindmap

Python : Dealing with Errors

  1. Here is some error types

    • TypeError : Raised when an unsupported operand type for 2 different DataType
    • NameError : Raised when a variable in not found in the local or global scope
    • IndexError : Raised when the index of a sequence is out of range.
    • OverflowError : Raised when the result of an arithmetic operation is too large to be represented.
    • ZeroDivisionError : Raised when 0 is defined as a divisor
  2. Error Handling

    • 1__We can transform a code with Errors to a clean code that daesn't cause any Errors
      • 2__For that we should use the Try and Except keywords,
      • 3__In the "try" we defind the code, and in the "except" we define what the program should do if the code caused the Error definded in the Except block
    • Look at this explaining Example
  3. User-Defined Error's

    • 1__In Python there is a way to creat our own Errors, that means that we tell the program that an action caused by a block of code is considered as an Error
    • 2__For that we should create a class whit the Error's name and the word "Exception" ......Class Error'sName(Exception): After that we write a message using the triple quotition marks..... like that: """the printing message""""
    • 3__We didn't finished yet. we should use the if statement .in this statement we're going to write : raise Error'sName. to raise the Error definded. Then we use the try and except block.
      • 4__Look at this Explaining Example
  4. Use of Else and Finally blocks

    • Use of else: The else block is used to execute a code if there is no Error detected in the try block
    • Use of Finally : The finally block is used to execute a code whatever if a Error is catching or not,
    • Look at this explaining Example

Bilder und Dateien der Mindmap

  • Python : Dealing with Errors
  • Python : Dealing with Errors
  • Python : Dealing with Errors

Informationen

Beschreibung
Mindmap am Python : Dealing with Errors, erstellt von Briache Issam am 20/08/2021.
Erstellt von
Briache Issam
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck