On 13/08/13 18:19, Alan Gauld wrote:
On 13/08/13 17:45, #PATHANGI JANARDHANAN JATINSHRAVAN# wrote:
def check(num):
lis=[20,19,18,17,16,14,13,11] #because a no. divisible by 20 is
for i in lis:
if num%i==0:
continue
else:
return False
break
return True
This is a bit convoluted. All you need is
for i in lis:
if num%i != 0:
return False
return True
Oops, that last return should be outside the loop, sorry...
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor