I want to determine if all the characters in a given string (say z) are alphanumeric (numbers and letters only).
The function should return True if the string is alphanumeric and False if not. I additionally want to avoid using conditional branching, relational, or Boolean operators, or any built in functions except type casting functions.
For any iteration, use a while loop with condition: True. Use try and except blocks.
what I have so far:
def is_alnum(z):
i = 0
y = 0
while True:
try:
try:
y = int(z[i])
except(ValueError):
### don't know what to insert
except(IndexError):
return True
i += 1