Can you solve this Python code question?

Jack G

New member
Write a python function definition isListOfPosInts that takes exactly one parameter called theList, and return True if a list consists entirely of positive integers. In every other case, it should return False.


I have written:

def isListOfPosInts(theList):
for i in range(1,len(theList)):
if i > 0:
return True
else:
return False
But it is not working...Please help!!
 
Back
Top