1.

Which of the following expressions results in an error?(a) float(‘10’)(b) int(‘10’)(c) float(’10.8’)(d) int(’10.8’)I had been asked this question during an interview.This intriguing question comes from Precedence and Associativity in chapter Precedence and Associativity, Bitwise & Boolean of Python

Answer»

The correct ANSWER is (d) INT(’10.8’)

The best I can explain: All of the above examples show EXPLICIT conversion. However the expression int(’10.8’) RESULTS in an ERROR.



Discussion

No Comment Found

Related InterviewSolutions