Movatterモバイル変換


[0]ホーム

URL:


RP
Uploaded byRifanti Putri
PPTX, PDF150 views

Python error handling

This document discusses common error types in Python programming:1. Indentation errors occur due to incorrect use of spaces and tabs in code formatting. 2. Type errors happen when an operation is applied to an object of the wrong type. 3. Value errors result from problems with the value assigned, such as putting an object of one type where an object of another type is expected.4. Syntax errors arise from incorrect syntax like missing parentheses or operators.

Embed presentation

Download to read offline
Anggota Kelompok : || Dosen : Dr. Fariz DarariAynunNissaSetiawanNadhiraRafikRifantiPutriTallishaAnnisaNurFitrianaPYTHON ERRORHANDLING[1906399202] [1906399253][1906293234] [1906399101]
Type ErrorSyntax ErrorValue ErrorName ErrorIndentation ErrorKey ErrorIndex Error#DebugOtakError
Newbie + Copy-PasteSpaceTabThis error primarily occurs because there are space ortab errors in your code.Some of the causes of the error are:• You are using both spaces and tabs in your code.• You have placed some indent wrong..• You forgot to indent the compound statements suchas ‘if’, ‘for’, ‘while’ etc.• You forgot to indent user-defined functions orclasses.INDENTATION ERROR
TYPE ERRORTypeError is thrown when an operation or function is appliedto an object of an inappropriate type.Because the plus operator (+) expected two numericparameters, Python throws a TypeError, telling us that one ofour parameters was of the incorrect type.
VALUE ERRORTo encounter a ValueError in Python means that is a problem with the contentof the object you tried to assign the value to.Imagine you have a dog and you try to put it in a fish tank. This would be anexample of a type error, because animals of type ‘dog’ certainly are not thesame as animals of type ‘fish’.On the other hand, imagine we tried to put a Great Dane into a Chihuahua’skennel. This would be a problem with the value of the dog, because althoughthey are both of type ‘dog’, a Chihuahua’s kennel would not be able to accepta dog the size of a Great Dane.
SYNTAX ERROR• Basic type of error in Python• Syntax Error arise when the Pythonparser is unable to understand thecode• Most syntax errors are incorrectidentation, typos, or incorrectargumentsBecause the inconsistent quotes, so Python throwsa SyntaxError
INDEX ERROR• Index Error raised whenever attemptingto access an index that is outside thebounds of a list• If you try to access an item in a listthat doesn’t exist, you will get listindex out of range• Python doesn’t want to access an itemthat doesn’t exist.
Why Name Error AriseName Error is raised when you tried to use a variable,method or function that is not initialized.It also arise when you want to access local variable fromglobalIt can also happen because you forgot to use an appropriateimport statement before using additional functionalityNAME ERROR
KEY ERRORKey Error is raised whenyou try to access a keythat isn’t in a dictionaryKey Error also raised inother places in Python’sStandard Library, suchas in the zipfile module,if an item is not foundin a ZIP archiveCOMMON CASERARE CASE
RESOURCES http://cs.carleton.edu/cs_comps/1213/pylearn/final_results/encyclopedia/valueError.html#:~:targetText=ValueErrors%20in%20Python,confused%20with%20types%20in%20Python. https://teamtreehouse.com/community/in-python-whats-the-difference-between-a-type-error-and-a-value-error https://www.tutorialsteacher.com/python/error-types-in-python#:~:targetText=Python%20%2D%20Error%20Types,usually%20along%20with%20the%20reason. https://en.wikibooks.org/wiki/Python_Programming/Errors https://realpython.com/python-keyerror/

Recommended

PPTX
LECT 29- EXCEPTION HANDLING.pptx b.
PPTX
Exception Handling and Modules in Python.pptx
PDF
Getting started with scala cats
PPTX
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
PDF
Exception handling3.pdf
PPT
Grade 11 CS Review (unit 1)
PPTX
Errorhandlingbyvipulkendroyavidyalayacrpfmudkhed.pptx
PPTX
Event handling
PPTX
Python Unit II.pptx
PPTX
Python Exception Handling
PPTX
PYTHON PPT.pptx
PPTX
Exception Handling in Python
PPT
Exception handling and function in python
PPTX
Exception Handling in Python programming.pptx
PPTX
EXCEPTION HANDLING class 12th computer science.pptx
PPTX
Introduction to Python_Debugging_Errors.pptx
 
PDF
Basic Concepts in Python
PDF
Python programming : Exceptions
PPTX
Download Wondershare Filmora Crack Latest 2025
PPTX
FL Studio Producer Edition Crack 24 + Latest Version [2025]
PPTX
Chapter 13 exceptional handling
PPTX
Python-exceptionHandling.pptx
PPTX
Adobe Photoshop 2025 Cracked Latest Version
PPTX
Python Basics
PPTX
Python_Beginner_Mistakes_and_how_to_Avoid_Them.pptx
PPTX
Python Exception Handling (Python Course)
PPTX
Python Lecture 7
PDF
Past Memories and a New World: Photographs of Stoke Newington from the 70s, 8...
PDF
AI Chatbots and Prompt Engineering - by Ms. Oceana Wong

More Related Content

PPTX
LECT 29- EXCEPTION HANDLING.pptx b.
PPTX
Exception Handling and Modules in Python.pptx
PDF
Getting started with scala cats
PPTX
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
PDF
Exception handling3.pdf
PPT
Grade 11 CS Review (unit 1)
PPTX
Errorhandlingbyvipulkendroyavidyalayacrpfmudkhed.pptx
PPTX
Event handling
LECT 29- EXCEPTION HANDLING.pptx b.
Exception Handling and Modules in Python.pptx
Getting started with scala cats
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
Exception handling3.pdf
Grade 11 CS Review (unit 1)
Errorhandlingbyvipulkendroyavidyalayacrpfmudkhed.pptx
Event handling

Similar to Python error handling

PPTX
Python Unit II.pptx
PPTX
Python Exception Handling
PPTX
PYTHON PPT.pptx
PPTX
Exception Handling in Python
PPT
Exception handling and function in python
PPTX
Exception Handling in Python programming.pptx
PPTX
EXCEPTION HANDLING class 12th computer science.pptx
PPTX
Introduction to Python_Debugging_Errors.pptx
 
PDF
Basic Concepts in Python
PDF
Python programming : Exceptions
PPTX
Download Wondershare Filmora Crack Latest 2025
PPTX
FL Studio Producer Edition Crack 24 + Latest Version [2025]
PPTX
Chapter 13 exceptional handling
PPTX
Python-exceptionHandling.pptx
PPTX
Adobe Photoshop 2025 Cracked Latest Version
PPTX
Python Basics
PPTX
Python_Beginner_Mistakes_and_how_to_Avoid_Them.pptx
PPTX
Python Exception Handling (Python Course)
PPTX
Python Lecture 7
Python Unit II.pptx
Python Exception Handling
PYTHON PPT.pptx
Exception Handling in Python
Exception handling and function in python
Exception Handling in Python programming.pptx
EXCEPTION HANDLING class 12th computer science.pptx
Introduction to Python_Debugging_Errors.pptx
 
Basic Concepts in Python
Python programming : Exceptions
Download Wondershare Filmora Crack Latest 2025
FL Studio Producer Edition Crack 24 + Latest Version [2025]
Chapter 13 exceptional handling
Python-exceptionHandling.pptx
Adobe Photoshop 2025 Cracked Latest Version
Python Basics
Python_Beginner_Mistakes_and_how_to_Avoid_Them.pptx
Python Exception Handling (Python Course)
Python Lecture 7

Recently uploaded

PDF
Past Memories and a New World: Photographs of Stoke Newington from the 70s, 8...
PDF
AI Chatbots and Prompt Engineering - by Ms. Oceana Wong
PDF
The invasion of Alexander of Macedonia in India
PDF
Agentic AI and AI Agents 20251121.pdf - by Ms. Oceana Wong
PPTX
Finals - History and Geography Quiz - Around the World in 80 Questions - IITK
PPTX
Photography Pillar 1 The Subject PowerPoint
PDF
CXC-AD Associate Degree Handbook (Revised)
PPTX
Session 5 Overview of the PPST and Its Indicators (COI and NCOI).pptx
PDF
Digital Electronics – Registers and Their Applications
PDF
Rigor, ethics, wellbeing and resilience in the biomedical doctoral journey
 
PPTX
kklklklklklklklk;lkpoipor[3rjdkjoe99759893058085
PDF
Unit 4_ small scale industries & Entrepreneurship
PPTX
Time Series Analysis - Least Square Method Fitting a Linear Trend Equation
PPTX
Anatomy of the eyeball An overviews.pptx
PPTX
Time Series Analysis - Weighted (Unequal) Moving Average Method
PDF
Unit 1- Basics of Management Cha. of Magmt
PPTX
Chapter 3. Pharmaceutical Aids (pharmaceutics)
PPTX
Introduction to Beauty Care and Wellness Services.pptx-day fcs 3rd quarter tl...
PDF
Hybrid Electric Vehicles Descriptive Questions
PPTX
LYMPHATIC SYSTEM.pptx it includes lymph, lymph nodes, bone marrow, spleen
Past Memories and a New World: Photographs of Stoke Newington from the 70s, 8...
AI Chatbots and Prompt Engineering - by Ms. Oceana Wong
The invasion of Alexander of Macedonia in India
Agentic AI and AI Agents 20251121.pdf - by Ms. Oceana Wong
Finals - History and Geography Quiz - Around the World in 80 Questions - IITK
Photography Pillar 1 The Subject PowerPoint
CXC-AD Associate Degree Handbook (Revised)
Session 5 Overview of the PPST and Its Indicators (COI and NCOI).pptx
Digital Electronics – Registers and Their Applications
Rigor, ethics, wellbeing and resilience in the biomedical doctoral journey
 
kklklklklklklklk;lkpoipor[3rjdkjoe99759893058085
Unit 4_ small scale industries & Entrepreneurship
Time Series Analysis - Least Square Method Fitting a Linear Trend Equation
Anatomy of the eyeball An overviews.pptx
Time Series Analysis - Weighted (Unequal) Moving Average Method
Unit 1- Basics of Management Cha. of Magmt
Chapter 3. Pharmaceutical Aids (pharmaceutics)
Introduction to Beauty Care and Wellness Services.pptx-day fcs 3rd quarter tl...
Hybrid Electric Vehicles Descriptive Questions
LYMPHATIC SYSTEM.pptx it includes lymph, lymph nodes, bone marrow, spleen

Python error handling

  • 1.
    Anggota Kelompok :|| Dosen : Dr. Fariz DarariAynunNissaSetiawanNadhiraRafikRifantiPutriTallishaAnnisaNurFitrianaPYTHON ERRORHANDLING[1906399202] [1906399253][1906293234] [1906399101]
  • 2.
    Type ErrorSyntax ErrorValueErrorName ErrorIndentation ErrorKey ErrorIndex Error#DebugOtakError
  • 3.
    Newbie + Copy-PasteSpaceTabThiserror primarily occurs because there are space ortab errors in your code.Some of the causes of the error are:• You are using both spaces and tabs in your code.• You have placed some indent wrong..• You forgot to indent the compound statements suchas ‘if’, ‘for’, ‘while’ etc.• You forgot to indent user-defined functions orclasses.INDENTATION ERROR
  • 4.
    TYPE ERRORTypeError isthrown when an operation or function is appliedto an object of an inappropriate type.Because the plus operator (+) expected two numericparameters, Python throws a TypeError, telling us that one ofour parameters was of the incorrect type.
  • 5.
    VALUE ERRORTo encountera ValueError in Python means that is a problem with the contentof the object you tried to assign the value to.Imagine you have a dog and you try to put it in a fish tank. This would be anexample of a type error, because animals of type ‘dog’ certainly are not thesame as animals of type ‘fish’.On the other hand, imagine we tried to put a Great Dane into a Chihuahua’skennel. This would be a problem with the value of the dog, because althoughthey are both of type ‘dog’, a Chihuahua’s kennel would not be able to accepta dog the size of a Great Dane.
  • 6.
    SYNTAX ERROR• Basictype of error in Python• Syntax Error arise when the Pythonparser is unable to understand thecode• Most syntax errors are incorrectidentation, typos, or incorrectargumentsBecause the inconsistent quotes, so Python throwsa SyntaxError
  • 7.
    INDEX ERROR• IndexError raised whenever attemptingto access an index that is outside thebounds of a list• If you try to access an item in a listthat doesn’t exist, you will get listindex out of range• Python doesn’t want to access an itemthat doesn’t exist.
  • 8.
    Why Name ErrorAriseName Error is raised when you tried to use a variable,method or function that is not initialized.It also arise when you want to access local variable fromglobalIt can also happen because you forgot to use an appropriateimport statement before using additional functionalityNAME ERROR
  • 9.
    KEY ERRORKey Erroris raised whenyou try to access a keythat isn’t in a dictionaryKey Error also raised inother places in Python’sStandard Library, suchas in the zipfile module,if an item is not foundin a ZIP archiveCOMMON CASERARE CASE
  • 10.
    RESOURCES http://cs.carleton.edu/cs_comps/1213/pylearn/final_results/encyclopedia/valueError.html#:~:targetText=ValueErrors%20in%20Python,confused%20with%20types%20in%20Python. https://teamtreehouse.com/community/in-python-whats-the-difference-between-a-type-error-and-a-value-errorhttps://www.tutorialsteacher.com/python/error-types-in-python#:~:targetText=Python%20%2D%20Error%20Types,usually%20along%20with%20the%20reason. https://en.wikibooks.org/wiki/Python_Programming/Errors https://realpython.com/python-keyerror/

[8]ページ先頭

©2009-2025 Movatter.jp