def checker(a_list):
for item in a_list:
if str(item).isdigit():
return True
else:
return False
The variable I have for checker is a list of four string containing variables. I planned to use it as a 'checker' to see if all input values of another function contained only digits.
Problem: If the first item in a_list is not a number, checker returns False as it should. However, if the first item is a number while any others in the list aren't, checker returns True anyways. This causes the next function to proceed with the non-number variables and results in an error.
How do I make it so my function checks the entire list before returning True? Or if need be, how do I make a new function that does what I'm looking for? Thanks