Here is the code I have got so far. Now output is `[1, 3, 5, 7, 9]`

```
N = 10
for i in range(1, 10):
arr.append(i)
arr2 = []
f = lambda x: x ** 2
arr2 = filter(lambda x: x % 2 != 0, arr)
map(lambda x: x ** 2, arr2)
print(list(arr2))```
```

Here is the code I have got so far. Now output is `[1, 3, 5, 7, 9]`

```
N = 10
for i in range(1, 10):
arr.append(i)
arr2 = []
f = lambda x: x ** 2
arr2 = filter(lambda x: x % 2 != 0, arr)
map(lambda x: x ** 2, arr2)
print(list(arr2))```
```

2

On

Here's a very slightly modified version:

```
arr = []
N = 10
for i in range(1, N):
arr.append(i)
arr2 = []
f = lambda x: x ** 2
arr2 = filter(lambda x: x % 2 != 0, arr)
for i in list(arr2):
print(f(i))
```

`arr2`

isn't a list. It's an iterator, which you can only convert to a list once.

Here's a more compact version:

```
N = 10
arr = range(1, N)
square = lambda x: x ** 2
keep_odd = lambda x: x % 2 != 0
arr2 = list(filter(keep_odd, arr))
for i in arr2:
print(square(i))
print(arr2)
```

It outputs:

```
1
9
25
49
81
[1, 3, 5, 7, 9]
```

1

On

You aren't saving the value in the array, you are just printing it.

```
N = 10
for i in range(1, 10):
arr.append(i)
result = []
f = lambda x: x ** 2
arr2 = filter(lambda x: x % 2 != 0, arr)
for i in arr2:
result.append(f(i))
print(result)
```

You are discarding the result of

`f(i)`

as soon as you create it. You need to append it to some list (also, no need to consume the`filter`

object into a list):Please note that binding a lambda to an identifier is discouraged in accordance with PEP 8.

The best way to solve this problem is without list comprehensions is a combination of

`filter`

and`map`

like so: