to display the numbers ranging b/w a particular range?
consider the example:
l = [11, 12, 13, 14, 14, 15, 16, 17, 18, 19, 19, 20, 30, 40]
now i need to display the numbers ranging b/w 12 to 16 so the output must be
[12, 13, 14, 14, 15, 16]
I did write a sample code but it displays the entire input:
l = [11,12,13,14,14,15,16,12,17,18,19,19,20,30,40]
for i in range(len(l)):
if ( l[i]==12):
print l
the output was:
[11,12,13,14,14,15,16,12,17,18,19,19,20,30,40]
if anyone could suggest a code in python to do this it will be
helpful.........
No comments:
Post a Comment