What will be the output of the following Python code? [code]hex(255), int('FF', 16), 0xFF[/code]

What will be the output of the following Python code?
Code:
hex(255), int('FF', 16), 0xFF
A. [0xFF, 255, 16, 255]
B. (‘0xff’, 155, 16, 255)
C. Error
D. (‘0xff’, 255, 255)
 
Answer: d
Explanation: The code shown above converts the value 255 into hexadecimal, that is, 0xff. The value ‘FF’ into integer. Hence the output of the code shown is: (‘0xff’, 255, 255).
 

Tìm kiếm

Back
Top