Exam-style question
Try this first
What is the most appropriate reason for placing input conversion inside a try block in Python?.
- A.The conversion may cause an exception for unsuitable input
- B.The conversion can only be performed inside a try block
- C.A try block automatically validates every possible input
- D.A try block changes text input into output
Model answer
What a good answer should say
- The conversion may cause an exception for unsuitable input
Explanation
Why this works
If text cannot be converted to the required data type, an exception may occur. Placing the conversion in a try block allows the program to provide a planned response.
Common mistake
No common mistake is linked to this question yet.
