Institute of Computer Science
  1. Courses
  2. 2025/26 fall
  3. Introduction to Programming (MTAT.03.236)
ET
Log in

Introduction to Programming 2025/26 fall

  • Home Page
  • Introduction
  • Expressions
  • Conditional Execution
  • Functions
  • Iterations
  • Strings
  • Files
  • Lists
  • Graphics?
< previousTable of Contents järgmine >

6.6 COMMON ERRORS

TYPE ERRORS

As mentioned numerous times, strings are immutable and characters within a string cannot be altered. Trying to do so results in a TypeError as can be seen from the Thonny example below.

Also, trying to concatenate types that do not match without converting them before, such as integer and string will lead to a TypeError. Here you can see a brief example of such scenario in Thonny.

INDEX ERRORS

Accessing an index that is out of the range of the string length. Strings are indexed like lists, and attempting to access an index outside the range will result in an IndexError.

< previousTable of Contents järgmine >

  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment