## Python: Lists, Loops, Append

#### Sharing buttons:

all right let's create a list you can

call the list y y equals square and a

square that's an empty list the next

thing I'm going to do is fill that list

up with values all right here we go I'll

do it within a look for X variable X in

a range of values what range of values

well I want X to start off with value 0

I want it to end up with 9 well that's

now you'll end up with 9 it'll be 9

minus 1 that's the maximum range range

value so you subtract 1 from it all the

time so 0 to 9 minus 1 that's 0 to 8 and

skip every two values that sounds good

and I end up with : like so and now me

banks pairs with one two three four and

now I don't want to print it out I once

I want to take that Y list and say mr.

Wein yes I want you to append onto

yourself onto your empty list right now

whatever the value is in X and I hit

enter once twice now what just happened

here by creating an empty list and then

I said for eggs in the range 0 9 2 what

does that mean well X has to start off

with the value 0 and so it takes to 0

okay done here jumps to the next line

mr. y yes append the value of that's an

X to yourself so it dates to 0 and

appends it right into there Wow

so as zeros in there oh I can't put a 0

in there right now for a demonstration

of our purposes but it's there okay oh I

couldn't do it down here it's

meaningless but I'll do it for demo

purposes on

so now this is zero in here now what

does he do now he jumps up over here

again to the X to the 4x line and he

goes I was a zero now I'm going to be

one oh no I got to add two to myself so

0 plus 2 is 2 so he jumps down here mr

why-would-you append the value of next

to yourself that's a 2 so he jumps over

the y any now what pens to onto the end

of himself well it's great he jumps back

up to the time because he's not done yet

he hasn't reached a limit he hasn't

passed it and he says 4 X in the range

I'm - now I got a head two more onto

myself that's four I haven't passed the

limit yet so I'm gonna miss - why would

you append the value 4 onto yourself so

he goes and adds a 4 on to himself wow

this is incredible and we just back up

here to the four line for X in the range

0 meant oh he's four now he had to onto

himself that six okay that didn't pass

the limit 6 so now mr. white append the

value 6 onto yourself so he jumps over

to Y and he adds a 6 on - why

wow this is getting real good yeah he

jumps back up to this line he says I'm 6

had tuna myself I'm 8 - the best limit

no I haven't best limit yet jumps down

here mr. y es append the value 8 onto

yourself and he does he puts him eat in

there then he jumps back up here and he

says 4 X in the range 0 9 - I made now

let me add to that gives me 10 oops I've

just passed the limit of 9 - 1 that's 8

I've passed it by 2

I cannot perceive any further can't do

it that's it I'm done and he jumps down

here and he closes this off like so and

that is what Y looks like right now ok

you say to me prove it

okay well let's prove it right now Kim

the value y in the head under dollars

two dollars I get zero two four six and

eight here we go voila

there it is this is George wall please

Sharon read this video that means click

on the like button and I wish a lot so

long bye bye now