7.4k views
4 votes
What is runtime error in Python? Provide an example

1 Answer

6 votes

Answer:

If the program is syntactically correct means there are no syntax errors in the program the python interpreter will execute the program.But if the program exits unexpectedly then there exists a run-time error in the python program.

For Example:-

  1. Accessing a list element which does not exists.
  2. divide by 0.
  3. Accessing a file which does not exists.
  4. Performing operation on incompatible types.

For ex:-

my_list=[1,34,7,3,7,8]

print(my_list[6])

This code will produce run-time error.

User Anakin Skywalker
by
8.1k points