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

PDF
Getting started with scala cats
PPTX
Event handling
PPT
Grade 11 CS Review (unit 1)
PPTX
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
PPTX
LECT 29- EXCEPTION HANDLING.pptx b.
PPTX
Errorhandlingbyvipulkendroyavidyalayacrpfmudkhed.pptx
PPTX
Exception Handling and Modules in Python.pptx
PDF
Exception handling3.pdf
PPTX
Python_Beginner_Mistakes_and_how_to_Avoid_Them.pptx
PPTX
Python Exception Handling
PPTX
Python-exceptionHandling.pptx
PPTX
Introduction to Python_Debugging_Errors.pptx
 
PPTX
Python Unit II.pptx
PPTX
Python Exception Handling (Python Course)
PPTX
Python Basics
PPTX
Chapter 13 exceptional handling
PPTX
Python Lecture 7
PPT
Exception handling and function in python
PDF
Basic Concepts in Python
PPTX
EXCEPTION HANDLING class 12th computer science.pptx
PPTX
PYTHON PPT.pptx
PPTX
Download Wondershare Filmora Crack Latest 2025
PPTX
Adobe Photoshop 2025 Cracked Latest Version
PPTX
FL Studio Producer Edition Crack 24 + Latest Version [2025]
PDF
Python programming : Exceptions
PPTX
Exception Handling in Python
PPTX
Exception Handling in Python programming.pptx
PDF
Deep Research and Analysis - by Ms. Oceana Wong
PDF
Unit 4_ small scale industries & Entrepreneurship

More Related Content

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

Similar to Python error handling

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

Recently uploaded

PDF
Deep Research and Analysis - by Ms. Oceana Wong
PDF
Unit 4_ small scale industries & Entrepreneurship
PDF
DEFINITION OF COMMUNITY Sociology. .pdf
PPTX
G-Protein-Coupled Receptors (GPCRs): Structure, Mechanism, and Functions
PDF
ASRB NET 2025 Paper GENETICS AND PLANT BREEDING ARS, SMS & STODiscussion | Co...
PPTX
Photography Pillar 1 The Subject PowerPoint
PPTX
Anatomy of the eyeball An overviews.pptx
PDF
Digital Electronics – Registers and Their Applications
PPTX
Introduction to Beauty Care and Wellness Services.pptx-day fcs 3rd quarter tl...
PPTX
Declaration of Helsinki Basic principles in medical research ppt.pptx
PDF
Integrated Circuits: Lithography Techniques - Fundamentals and Advanced Metho...
PPTX
Prelims - History and Geography Quiz - Around the World in 80 Questions - IITK
PDF
Unit 2: Functions of Management (POSDC.)
PDF
The invasion of Alexander of Macedonia in India
PPTX
Finals - History and Geography Quiz - Around the World in 80 Questions - IITK
PPTX
Organize order into course in Odoo 18.2 _ Odoo 19
PDF
AI and ICT for Teaching and Learning, Induction-cum-Training Programme, 5th 8...
PDF
IMPATT Diodes: Theory, Construction, Operation, and Microwave Applications"
PDF
Unit 1- Basics of Management Cha. of Magmt
PDF
বাংলাদেশ অর্থনৈতিক সমীক্ষা - ২০২৫ with Bookmark.pdf
Deep Research and Analysis - by Ms. Oceana Wong
Unit 4_ small scale industries & Entrepreneurship
DEFINITION OF COMMUNITY Sociology. .pdf
G-Protein-Coupled Receptors (GPCRs): Structure, Mechanism, and Functions
ASRB NET 2025 Paper GENETICS AND PLANT BREEDING ARS, SMS & STODiscussion | Co...
Photography Pillar 1 The Subject PowerPoint
Anatomy of the eyeball An overviews.pptx
Digital Electronics – Registers and Their Applications
Introduction to Beauty Care and Wellness Services.pptx-day fcs 3rd quarter tl...
Declaration of Helsinki Basic principles in medical research ppt.pptx
Integrated Circuits: Lithography Techniques - Fundamentals and Advanced Metho...
Prelims - History and Geography Quiz - Around the World in 80 Questions - IITK
Unit 2: Functions of Management (POSDC.)
The invasion of Alexander of Macedonia in India
Finals - History and Geography Quiz - Around the World in 80 Questions - IITK
Organize order into course in Odoo 18.2 _ Odoo 19
AI and ICT for Teaching and Learning, Induction-cum-Training Programme, 5th 8...
IMPATT Diodes: Theory, Construction, Operation, and Microwave Applications"
Unit 1- Basics of Management Cha. of Magmt
বাংলাদেশ অর্থনৈতিক সমীক্ষা - ২০২৫ with Bookmark.pdf

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