14,669,422 members
Rate this:
See more:
How to iterate a list having integer on >, < , >=,<= in python

What I have tried:

```def convert(*a):
for n in a:
if n<8:
print (n)
elif n>= 11 and n<=18:
print (n-2)
elif n>= 20 and n<=319:
print (n-3)
elif n>= 321 and n<=328:
print (n-4)
elif n>= 331 and n<=338:
print (n-6)
elif n>= 341 and n<=348:
print (n-8)
elif n>= 351 and n<=358:
print (n-10)
elif n>= 360 and n<=659:
print (n-11)
elif n>= 661 and n<=668:
print (n-12)
elif n>= 671 and n<=678:
print (n-14)
else:
print (0) ```

```list1=[34,332,34,75,454,76,78,898]
convert(list1)```
Posted
Updated 3-Mar-20 22:42pm
v2

Rate this:

Solution 1

You do not need the asterisk on the parameter name:
```def convert(a):
for n in a:```

Python knows that parameter `a` is a list, so there is no need to mark it as a variable set.
Richard MacCutchan 4-Mar-20 7:45am

What problem? When I run it it prints a list of values, all of which are correct:
```31
326
31
72
443
73
75
0
```
User-14705882 5-Mar-20 1:50am

yeah , thanks it works now