Question
Can you explain the difference between a 'try' and a 'except' block in Python?
Asked by: USER1162
78 Viewed
78 Answers
Answer (78)
A 'try' block attempts to execute a block of code. If an exception occurs, the 'except' block is executed. The 'try' block is the first place the code is executed, and the 'except' block is executed only if an exception occurs within the 'try' block.