Hello HF,
I have a simple question about a simple operation in python.
I'm attempting to pass a function a list (variable a), and exclude all numbers that are less than my second variable which is given by the user ®.
Could anybody explain to me why my code doesn't work? (I don't have any formal learning with python, I'm taking Java questions from an old course and replicating them to teach myself.)
Thanks :)
I have a simple question about a simple operation in python.
I'm attempting to pass a function a list (variable a), and exclude all numbers that are less than my second variable which is given by the user ®.
Code
def threshold(a,x):
for i, val in enumerate(a):
if a[i] < x:
a.remove(a[i]);
return a;
r = int(raw_input("Enter a number to take the threshold of:"));
print threshold([0,1,2,3,4,5,6],r);Could anybody explain to me why my code doesn't work? (I don't have any formal learning with python, I'm taking Java questions from an old course and replicating them to teach myself.)
Thanks :)


![[Image: OLA3irL.gif]](https://i.imgur.com/OLA3irL.gif)
