I am trying to compare a user input to every element of a list, where NL is the list, but for some reason it never enters the else loop.
NL = range(1, sc.NLayer + 1)
if (x for x in NL if x < sc.NLayer):
print 'true'
else:
print 'false'
sc.NLayer is user input.
assume sc.NLayer = 5; it is not hitting the else condition . Please help
You might want to use the built in
anyfunction.So in your code, it would be:
or possibly a for loop: