int('a') produces error. Why ?
20 Likes
int() converts its argument into an integer. As 'a' is a letter, it cannot be converted into a valid integer hence int('a') produces an error.
Answered By
15 Likes
Write expression to convert the values 17, len('ab') to (i) integer (ii) str (iii) boolean values
int('a') produces error but following expression having int('a') in it, does not return error. Why?
len('a') + 2 or int('a')