GIAC Python Coder (GPYC) — Question 1
Which of the following would produce this list?
[65, 66, 67, 68]
Answer options
- A. range(1,4) + 64
- B. for x(4)+64
- C. map(ord, ג€ABCDג€)
- D. range(4)+ 65
Correct answer: D
Explanation
The correct answer is D because the range(4) generates the numbers 0, 1, 2, 3, and adding 65 to each results in the list [65, 66, 67, 68]. Option A will not work as it attempts to add a number to a list incorrectly, B is syntactically incorrect, and C will not produce the desired list since it maps the ord function over the characters in 'ABCD'.