why python index() function raises error in case element not present, can't it simply return -1

Viewed 23

do we Always need to use try catch blocks while finding index of elements, when we are not sure weather the element present or not or is there any function exists that returns -1.

0 Answers
Related