Câu 6: PCED-30-02: PCED - Certified Entry-Level Data Analyst with Python
You are writing a function named process_data() to read and process numerical input from a file. The function must: read the file data.txt, attempt to convert the first line into an integer, handle file, conversion, or index-related exceptions, print the value only if no error occurs, and always print a final message…
Nội dung câu hỏi
You are writing a function named process_data() to read and process numerical input from a file. The function must: read the file data.txt, attempt to convert the first line into an integer, handle file, conversion, or index-related exceptions, print the value only if no error occurs, and always print a final message after execution. Which implementation correctly and robustly meets all these conditions? Select the best answer.
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
-
A. Lựa chọn A bằng hình ảnh — đáp án hiện tại
-
B. Lựa chọn B bằng hình ảnh
-
C. Lựa chọn C bằng hình ảnh
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.