1
00:00:00,660 --> 00:00:05,960
Previously we built this list comprehension which iterates over this list and divides by 10

2
00:00:05,970 --> 00:00:13,020
each item of that is lists and it ignores only if temp is different than minus 9999.

3
00:00:13,620 --> 00:00:17,110
So what happens if temp is equal to that number?

4
00:00:17,140 --> 00:00:23,680
Well, the loop, the list comprehension will ignore that value as you so in the output.

5
00:00:23,790 --> 00:00:25,400
So that was the output.

6
00:00:25,470 --> 00:00:30,570
So what if you want to put another value instead of that? Let's say you want to put the zero instead

7
00:00:30,570 --> 00:00:32,570
of that negative number.

8
00:00:32,610 --> 00:00:39,830
In that case if you think you can just do else here zero you try this out.

9
00:00:39,860 --> 00:00:46,860
You would be wrong because that will produce a syntax error.
When you have an if else inside a list comprehension

10
00:00:47,250 --> 00:00:51,120
the order or the components is a bit different.

11
00:00:51,120 --> 00:01:00,870
You have to get the for temp in temps so the loop has to be after the conditional.

12
00:01:00,880 --> 00:01:07,740
Just like that if you execute that, you're going to get the expected results.

13
00:01:07,860 --> 00:01:12,630
So you see the zero there instead of minus 9999.

14
00:01:12,810 --> 00:01:18,240
So the list comprehension this time goes like this.
Give me temp divided by 10

15
00:01:18,350 --> 00:01:21,570
only if temp is different than this number.

16
00:01:21,600 --> 00:01:24,230
Else give me 0 for temp

17
00:01:24,230 --> 00:01:31,680
in temps, so always remember that if you have to do an if else inside a list comprehension the for loop

18
00:01:31,710 --> 00:01:34,020
goes at the very end like that.

