Back
  • Qissba
  • Courses

      CBSE Class 12

      PYTHON

      Computer Science

      • Python
      • Computer System Overview
      • Computer Networks
      • society Law & Ethics
      • Data Representation
      • Boolean Logics
      Python Online Free Courses for Classes 11th and 12th
  • Blog
  • Shop
    • Cart
    • Checkout
    • My account
  • About Us
  • Contact
  • Career
Have any question?
(+91) 09897990175
qissba@gmail.com
RegisterLogin
Qissba
  • Qissba
  • Courses

      CBSE Class 12

      PYTHON

      Computer Science

      • Python
      • Computer System Overview
      • Computer Networks
      • society Law & Ethics
      • Data Representation
      • Boolean Logics
      Python Online Free Courses for Classes 11th and 12th
  • Blog
  • Shop
    • Cart
    • Checkout
    • My account
  • About Us
  • Contact
  • Career

    Computer Science

    Errors in Python | CBSE Class 11 | Computer Science

    • Posted by Kabeer Sahib
    • Categories Computer Science

    Dear Class 11th STUDENTS, ! Welcome to this tutorial of Errors in Python from your CBSE class 11 of Computer Science Syllabus .

    Table of Contents

    Toggle
    • Introduction to Errors in Python:
    • Types of Errors in Python:
      • Compile-Time Errors
      • Logical Errors
      • Run-time errors:
      • Exceptions

    In this tutorial, we shall be learning our chapter-6: Errors in Python from Unit 2: Programming and Computational Thinking (PCT-1)   as CBSE BOARD suggested to learn about computer system and its organisation to complete this section.

    After going through this tutorial, you will be able to understand the following topics from your latest syllabus 2025-26.

    Unit 2: Programming and Computational Thinking (PCT-1)        

    Chapter 6 : Errors in python:

    1. Syntax errors
    2. Logical errors
    3. Run-time errors

    I advice you to check the latest syllabus given by CBSE Board at its Official website: www.cbseacademic.nic.in

    Also, in this tutorial we will covers all necessary topics/concepts required to complete your exams preparations in CBSE  classes 11th.

     

    Also, you can Sign Up our free Computer Science Courses for classes 11th and 12th.

     

    full-python-course-for-beginners

    NOTE:

    • We are also giving some important Questions & Answers for better understanding as well as preparation for your examinations.
    • You may also download PDF file of this tutorial from our SHOP for free.
    • For your ease and more understanding, we are also giving the video explanation class of each and every topic individually, so that you may clear your topics and get success in your examinations.

     

     

    Introduction to Errors in Python:

    An error, sometimes called ‘a bug’, is anything in the code that prevents a program from compiling and running correctly. Some program bugs are catastrophic in their effects, while others are comparatively less harmful and still others are so unclear that you will ever discover them. There are broadly three types of errors: Compile-time errors, run-time errors and logical errors.

    Types of Errors in Python:

    Compile-Time Errors

    Errors that occur during compile-time, are compile-time errors. When a program compiles, its source code is checked for whether it follows the programming language’s rules or not. Two types of errors fall into category of compile-time errors.

    Syntax Errors

    Syntax errors occur when rules of a programming language are misused i.e., when a grammatical rule of Python is violated. For example, observe the following two statements:

    X<-YZ

    if X = (X *Y)

    These two statements will result in syntax errors as ‘<-‘ is not an assignment operator in Python and is the assignment operator, not a relational operator. Also, if is a block statement, it requires a colon (:) at the end of it, which is missing above.

    Therefore, the correct statements will be as follows:

    X = Y Z

    if X == (X + Y) :

    One should always try to get the syntax right the first time, as a syntax error wastes computing time and money, as well as programmer’s time and it is preventable.

     

    Semantics Errors

    Semantics Errors occur when statements are not meaningful. For instance, the statement ‘Sita plays Guitar’ is syntactically and semantically correct as it has some meaning but the statement Similarly, there are semantics rules of a programming language, violation of which results in ‘Guitar plays Sita’ is syntactically correct (as the grammar is correct) but semantically incorrect

    semantical errors. For instance, the statement

    X * Y Z

    will result in a semantical error as an expression cannot come on the left side of an assignment statement

     

    Logical Errors

    Sometimes, even if you don’t encounter any error during compile-time and run-time, your program does not provide the correct result. This is because of the programmer’s mistaken analysis of the problem he or she is trying to solve. Such errors are logical errors. For instance, an incorrectly implemented algorithm, or use of a variable before its initialization, or unmarked end for a loop, or wrong parameters passed are often the hardest to prevent and to locate. These must be handled carefully. Sometimes logical errors are treated as a subcategory of run-time errors. 8.7.10 Run-Time Errors

    Run-time errors:

    Errors that occur during the execution of a program are run-time errors. These are harder to detect errors. Some run-time errors stop the execution of the program which is then called program “crashed” or “abnormally terminated”.

    Most run-time errors are easy to identify because program halts when it encounters them eg., an infinite loop or wrong value (of different data type other than required) is input. Normally, programming languages incorporate checks for run-time errors, so does Python. However, Python usually takes care of such errors by terminating the program, but a program that crashes whenever it detects an error condition is not desirable. Therefore, a program should be robust so as to recover and continue following an error.

     

    Exceptions

    Errors and exceptions are similar but different terms. While error represents, any bug in the code that disrupts running of the program or causes improper output, an Exception refers to any irregular situation occurring during execution/run-time, which you have no control on. Errors in a program can be fixed by making corrections in the code, fixing exceptions is not that simple. Let us try to understand the difference between an error and exception with the help of real life

    example. if you operate an ATM then

    • entering wrong account number or wrong pin number is an ERROR.
    • ‘not that much amount in account’ is an EXCEPTION.
    • ‘ATM machine struck’ is also an EXCEPTION.

    So you can think of Exceptions in a program as a situation that occurs during runtime and you have no control on it e.g., you write a code that opens a data file and displays its contents on screen. This program’s code is syntactically correct and logically correct too. But when you run this program, the file that you are opening, does not exist on disk – So the program has no errors but an exception occurred.

    built-in-exceptions-cbse-class-11

     

     

    • Share:
    Kabeer Sahib

    A Trained Post Graduate Teacher with 10 years of experience and working as TGT/PGT–Computer Science including good Management and administration skills with managerial positions in previous work environments

    Previous post

    Basics of Python Programming Language | CBSE Class 11| Computer Science
    19 July 2025

    You may also like

    basics-of-python-programming-languages-cbse-class-11
    Basics of Python Programming Language | CBSE Class 11| Computer Science
    3 June 2025
    encoding-schemes-cbse-class-11-computer-science
    Encoding Schemes | ASCII | ISCII | Unicode | CBSE Class 11| Computer Science
    21 May 2025
    digital-number-system-in-data-representation-cbse-class-11
    Number System in Data Representation| CBSE Class 11| Computer Science
    21 May 2025

    Leave A Reply Cancel reply

    You must be logged in to post a comment.

    Search

    Categories

    • Computer Science
    • Education
    • Education News
    Computer Science : Python – CBSE Class 11

    Computer Science : Python – CBSE Class 11

    ₹1,999.00Free
    Computer Science : System Overview – CBSE Class 11

    Computer Science : System Overview – CBSE Class 11

    ₹999.00Free
    Computer Science : Python – CBSE Class 12

    Computer Science : Python – CBSE Class 12

    ₹1,999.00Free

    Login with your site account

    Lost your password?

    Not a member yet? Register now

    Log in

    Copyright @ 2021 ! QISSBA EDUCATION ! .

    • Privacy
    • Terms
    • Sitemap
    • About Us

    Login with your site account

    Lost your password?

    Not a member yet? Register now

    Register a new account

    Are you a member? Login now