Login and get codingMartin is preparing to pass an IQ test.
The most frequent task in this test is to find out which one of the given characters differs from the others. He observed that one char usually differs from the others in being alphanumeric or not.
Please help Martin! To check his answers, he needs a program to find the different one (the alphanumeric among non-alphanumerics or vice versa) among the given characters.
Complete
get_index_different_char
to meet this goal. It receives achars list
and returns anint index
(zero-based).Just to be clear, alphanumeric ==
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
Examples:
['A', 'f', '.', 'Q', 2] # returns index 2 (dot is non-alphanumeric among alphanumerics) ['.', '{', ' ^', '%', 'a'] # returns index 4 ('a' is alphanumeric among non-alphanumerics)See the TESTS tab for more details.
If you’re struggling with the solution, consider taking a look at this article about membership testing in Python.
771 out of 808 users completed this Bite.
Will you be the 772nd person to crack this Bite?
Resolution time: ~47 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 4.67 on a 1-10 difficulty scale.
» Up for a challenge? 💪