ITS-Python Troubleshooting and Error handling

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/9

flashcard set

Earn XP

Description and Tags

Last updated 2:04 PM on 4/28/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

10 Terms

1
New cards

What are the three main types of errors you need to recognize in Python?

Syntax errors, Runtime errors (Exceptions), and Logic errors.

2
New cards

In a try...except block, what is the role of the try block?

It contains the "risky" code that might potentially raise an exception.

3
New cards

When does the else block execute in exception handling?

Only if no exceptions were raised in the try block.

4
New cards

What is the primary purpose of the finally block?

To execute code regardless of whether an exception occurred or not.

5
New cards

How do you manually trigger an error in your code?

Use the raise keyword.

6
New cards

Which keyword is used in unit testing to check if a condition is true?

assert (e.g., assertEqual, assertTrue).

7
New cards

Why is it considered "bad practice" to use a "bare except" (just except:)

It catches every possible error, including system-exiting signals like KeyboardInterrupt.

8
New cards

If you want to catch two specific errors, like ZeroDivisionError and TypeError, in a single block, how would you write it?

except (ZeroDivisionError, TypeError):

9
New cards

What is a "Logic Error," and why is it often the hardest to fix?

A logic error is a mistake in the program's intended behavior.

10
New cards

Which standard library module is used for creating and running unit tests in Python?

unittest