📺 Develpreneur YouTube Episode

Video + transcript

Python Certification Training - Additional Exam Notes

2021-09-07 •Youtube

Detailed Notes

We start wrapping up with a review of some topics that need more discussion before taking the certification.

Useful Links: https://www.mygreatlearning.com/blog/understanding-mutable-and-immutable-in-python/ https://docs.python.org/3/tutorial/controlflow.html https://docs.python.org/3/whatsnew/3.0.html

Learn more about the overall certification and syllabus here: https://pythoninstitute.org/certification/pcap-certification-associate/pcap-exam-syllabus/

Github repository for code examples: https://github.com/robbroadhead/PythonCertificationSeries

Transcript Text
[Music]
well hello and welcome back we are
continuing our series of
tutorials to get ourselves to a python
certification
we've gotten through
the bulk of items and i've started
actually looking at the sample test that
they have
you'll find a link for it in the show
notes
and really it was just to
sort of make sure that we've covered
things
in a way that will be helpful
besides just
understanding some of the topics but
actually sort of understanding how
they're going to be used
and one of those
well actually several things
one that i'm going to sort focus on
today is mostly because of a complex
example and a couple little things
related to it that i don't think we
covered
specifically enough
has to do with for loops
but then there are some other things
that
i think i may have underestimated
uh or i could potentially be
underestimating what people know
so
it's good to make sure you're clear on
it
the first of those
is the idea of immutable versus
immutable
objects
the key in python is to know that
native types
integers doubles times strings those are
all immutable booleans they are
immutable
tuples and ranges also are immutable
other things are
mutable not immutable so
a list a dictionary those things are
immutable
the difference between them
the concept of mutable versus immutable
is that
either
the memory stamp where something exists
changes or it does not
so if you were to
for example
let's just sort of say let's say that
you've got
in memory
you've got this thing uh abcd that's a
string
okay
and this is uh in memory
slots
and what is that 0 through 3 for those
and then you and let's say you assign a
variable let's say x equals
that string
then that means that x is a pointer
to
basically zero
and then there's going to be something
to let you know when it's done you know
i don't want to get too complicated into
it
now
if you assign x equals
let's say x y z
then what's going to happen in this case
is that
abcd
is not going to ex going to change
there now is going to be
there's going to be let's say at 567
you're going to have xyz
and memory slots
five through seven
right four five six seven yes
and that memory slot four is probably
going to be a string terminator
it gets into pointer arithmetic a little
bit that
you may or may not have been exposed to
if it is
mutable that would mean that instead
what would happen is
that abcd would be essentially
overwritten
as opposed to here where it's
saying it's a string so that string
exists and
this variable points to it
here
i'm going to create another string
somewhere in memory and then point the
variable to it i'm not going to override
the memory for the string
and that works for any of the native
types and tuples and ranges
that's really what you need to know
because there are like a couple of
questions related to that
and i just i know i have not really
haven't really covered that at all so i
want to make sure that we brought that
up
similarly
i want to make sure you understand one
of the things that i saw that
sparked this idea is
understanding
powers
exponent exponents
so x to the y
and that one
let me move this
and let me do
i think it's easier to show some
examples
so
i'm going to take a bunch of these
these are all going to be strings so i'm
going to do it this way
i want to show you something here so if
i do 0
to the 0 power
0 to the 1 power
and 0 to the second power
and now let me take
3 to the 0 power
10 to the 0 power
and this number
to the 0 power
so let's look at those first
and we'll see
zero to the zero
is one as is three to zero ten to the
zero or this big number zero
anything to the zero power
or z power if you say it that way
is equal to
one
that includes
zero
other than that
other than
that
zero
to any power
is 0.
and so if i even do
0 to the
negative 74th power
i think it'll read that right hopefully
it will no uh
i think i need to do it that way
oh it says it cannot be raised to a
negative power so if you go to zero to
the negative power
is going to give you
an exception
which you may have to run into
let's go any other number
uh oops
so i can't do that
but i can now
do this and it's just going to give you
it so 0
and let's do that
0 to a negative
is an exception we'll say
it cannot calculate
but it can anything else
i think that's important because they do
have some questions related to those
and we've not really you know just sort
of assumed that you understood exponents
and if you're a little fuzzy with them
especially
these little rules
it's good to know
now
another thing we haven't talked about is
we've done prints
p-r-i-n-t-s
we have done print commands
but there are two things we've not
talked about
we have not talked about the sep
nor have we talked about
the end
and let's just do a
so normally when we print
we print and it just it gives us a new
line
so see here that
we just get a
a new line here
um
i don't want to do that
yeah i'll do that for now
let's do this the ends first
let's throw it through this so what i'm
going to do here so now if i do the one
two three with an end and then end on an
a
let's look at those
so
here um
i do
this gets hard to read example two
example one
and let's do
of this
and we're gonna put an extra little one
here
just to be sure
okay so now let's look at it
so if you look here example one
it prints but notice that it does not do
now instead
so instead of the end
being an end line which we would have
here
so if we get rid of this guy
and run it we're gonna see what looks
more familiar see we see the uh one two
three because it's doing
you can do commas uh you can do multiple
items within your print so it's gonna do
those and it just prints them all in one
line
and it gives us a line feed
if i say don't do that whoops
if i say don't do that
and do an end
now
that one two three
notice
it does have a little space between
those so it shows us that that's a set
essentially that's different items
and
the end now is only
on a you know an empty string so what
the end thing is
an empty string it's not
a return
so
it doesn't give us that line feed and
then it dives right into
example two
notice here
and this is just to be clear on it so
at the end of the line here instead of
adding a blank i'm going to add an a
so here it does 1a to a 3a and it still
does those little spaces to split
the
list essentially
and then at the end of line it does an a
so i could also do like i can do end of
line
and it'll come back with an eol there
you go
so end tells me what i want to put at
the end of my line if i want to change
something around a little bit this is
very important if you're doing like
comma separated lists or something like
that
and so for example let's take the same
thing
and i think i've got yeah
so now
let's do this
i'm just going to print
so i get space
and let's look at these now let's look
at the set
now set matters only if i've got a
series so if i look at this first one
that 1 2 3
that's where it's at that separator is a
empty string so now instead of the space
which is the default
it crams them together here i use a sep
of hashtag
and you can see here where it puts a
hashtag at the end of each of those
and so that would commonly be where like
let's say i wanted to do a pipe
delimited
thing that would build out my list of
items
and i now get a pipe delimited
series of items however uh if i do
i have a list floating around here
somewhere
i don't
so let's do one more thing and let's do
uh my list equals
one comma two comma three
and now let's do
my list
with a separator of a pipe
and notice
that it doesn't separate because the
list is printing out the whole list
it's not doing anything special with it
therefore
we're getting this
uh this is what we're getting
because we're getting the list in the uh
sort of the string representation of the
list
so we would have to and
uh
similarly just to be clear if i do 4x
in my list
and then let's just do
let's do here let's just do print
x comma separator equals this thing
then i'm still not going to get what i
want
so it prints each of these because the
separator doesn't print it's only
between items so what i would have to do
is i would have to change it to be this
and then
i'm going to get my one two three but
then i've got that extra one at the end
so you know you've got a couple
different ways to get to it but
particularly doing a series of things
you can play around with separators we
didn't see it very often but it does
show up in the test
apparently and the ends is good to know
and we haven't played around with that
so i want to like take a look at those
two
uh let's see so this
i wanted to look specifically
let's see there's my list okay so let's
move this down oh let's do this first
uh one thing we didn't talk about before
there we go
i think we specifically spent enough
time in
what you do if you come back if you grab
4x in sample where sample is a
dictionary
and that is that it is a key
so if we print
and it's home one two three the three
items are home and an address office and
an address bill in an address if we
print the sample itself
uh
it is
here oh yeah because i don't have the
line so it just gives us a nice string
representation of it that we see here
if we do
samples dot keys
then it gives us
a collection of dictionary keys with
those three
keys if we do val if we do sample.values
and you guys will have seen this before
we did the dictionary example
we get the three values
if we do
for x and sample it's going to go
through the key so you see the keys here
home office and bill
well x is home office and bill
so if we wanted to print the items from
here we would actually do
a sample sub x
will give us those three addresses
so let's see you go there we get our
three addresses so reminder that if you
do a 4x in a dictionary it's not giving
you the objects the pairs it's giving
you the keys
now if you want to do
so if i do x comma y and let's do
k comma value
and sample
then i can print
k
is
plus k
and v is
this v
i don't think we've played with this one
too much
too many values unpack in this case
because
it's only giving me keys
but if i were to do
uh
let's do
because it's not what i want is not key
value pairs so if instead i do let's do
sample 2.
and here
so i can come in here and i can see that
k
is what i'm assigning the first value
home office bill v is what i'm assigning
the second value in each of those three
addresses
and so i could make that very
complicated i could have three or four
items and i can assign all of them out
i can also do this with classes so there
are a lot of things i can do where i can
be i can break something out
basically within a loop and assign out
some values all at the same time we
don't really cover that so i want to
make sure that we did touch into that
one
and then another one i want to make sure
i get into
is um
well first off let me do this one
because this is a quick one so if i look
at sample two
if i do
print sample two
but i do
print
let's do sample three
equals sample two
and then i do a sample
two
now let me see
sorry
if i did delete sample two
and we'll leave it there so first let's
just do this
so i'm going to delete sample 2 item i'm
going to do negative 1
and then i'm going to print sample 2
again
let's just do it that way that's going
to be the easiest way to show this
and so what i get here
is
i'm not able to do it but if i do 0 to
negative 1
[Music]
oh shoot i want it that's not how i want
to do it anyways let me do this so if i
do 0 to negative 1 that's 1 i want to
see
because you will see that so
um
let's see so i come through vs answer so
i come here here's the whole thing
but if i go zero to negative one it's
going to build out it gets rid of the
last item if i go zero to negative two
see it starts it it's going to end up
and it deletes
yeah so it deletes the first one
if you notice here
if i do negative one
actually let me do this this way it's
gonna be easier to compare these two so
i wanna compare these two so if i go
zero to negative one blah
i'll blah
sample two
let's do this
sample three equals
sample two well
and then i'm going to try through all
that and then i'm going to do
2 equals sample 3 so i'm going to
rebuild that
all right so now look
and note
that
i lost it okay
so print sample two i do that if i
delete that and present sample two
then i get
this guy that's the only one that's left
and if i come in here
go zero to negative two so let me do
this
because it's gonna be easier
let's just do this
sorry
okay here we go
so sample two if i go from zero to
negative one
that's where i start
it gets rid of
this guy
and this guy
i'm sorry this this guy and this guy
if the range goes from zero to negative
two
then he gets rid of just this guy
because now he hasn't run around enough
but if i started with zero negative two
oh that is what i did okay
is that uh note that i'm losing
this guy
in each case if i go zero to negative
four
in this case
i end up getting rid of nothing
because i can't go to that it's an
invalid range
if i do negative
well
it pulls the last item off if i do
negative two
it's going to pull the middle item off
so baker street disappears
so if i go negative on it then
it's going to go it starts up here and
then it counts backwards so you can get
some sort of funky kind of stuff that
goes into it
so remember your negatives start
essentially your negatives start at the
right versus the left
now they do have i want to throw this
this one out there just to sort of walk
through something
they have this very complex question
which is this guy it basically says how
many stars are printed
the key
is this thing
is we've got this for c uh c for c in
range r which is
right a list for r in range
three so
if we just do
the four r in range 3 we know that
that's going to be 0 1 2 right so if we
go look we'll see that that is 0 1 and
2.
now this is where it becomes complicated
so
it's going to create this set
where
c is in range
r but r is 0 1 and 2.
and so the set
is going to be in the first one the
range 0 we don't do anything at all so
the set is an empty set
when you do range one
oh let me do this
when you do range one
then it's gonna be uh
zero to one
and so
you're gonna come here you're gonna get
once and then it's gonna be zero is the
only thing that's gonna be in there
two the items in the range are zero and
one so that's your sets
and then it comes out and says okay for
x and list
and list is this thing so the list items
are empty set
set with zero and a set with zero one
and so it's going to come in an empty
list and it's going to say for y and x
so there's nothing there it's an empty
set so nothing happens
the next time through it comes for 0
if 0 is less than 2 prints star yes it
does the next time it comes through and
it's going to go 0 zero is less than two
print star
and then one one is less than two print
star and so in the end it's going to
print three stars
so it's very very complicated
looking
but not terribly so
oh and that reminds me one other thing
because of order operations
um another thing to remember is that if
you do
exponents
those are not left to right so if i go 2
to the 3 to the 2
or let's say to the 4.
i don't do 2 to the 3 which is 8 and
then 8 to the 4th which is what is that
256.
instead i do 3 to the 4th which is 81
and then 2 to the 81 and that's going to
be a huge number so if i do this
perform that x let's just do this here
and so it's going to be a huge number
not 256. yeah so it's a huge number
which is not the same
as if i do this
oh i'm sorry it's not the same as if i
do this let me change the
order of operation
with 4096.
so you go from the outside first so the
right to the left when you're doing
exponents as far as order of operations
they'll do for this first part i only
this is only actually covering the first
half of the test as i went through it
and wanted to bring had some notes on
some additional things i wanted to bring
up
i apologize for maybe not being as clear
or not getting into some of these before
but i'm going to continue with this i'm
going to go take a look at the second
half of the test and see what kind of
notes i have that come out of that as
we're getting pretty darn close we are
almost there so
you can see all of this out in the
repository github repository where we
have links in the show notes
i'll get that caught up and uh go out
there have yourself a great day a great
week and we will talk to you
next time
you
Transcript Segments
0.46

[Music]

26.16

well hello and welcome back we are

28.84

continuing our series of

32.96

tutorials to get ourselves to a python

35.52

certification

36.96

we've gotten through

38.399

the bulk of items and i've started

41.36

actually looking at the sample test that

43.6

they have

45.039

you'll find a link for it in the show

47.28

notes

48.48

and really it was just to

50.559

sort of make sure that we've covered

51.84

things

52.719

in a way that will be helpful

55.039

besides just

56.8

understanding some of the topics but

59.199

actually sort of understanding how

60.399

they're going to be used

62.8

and one of those

64.4

well actually several things

66.88

one that i'm going to sort focus on

68.24

today is mostly because of a complex

71.92

example and a couple little things

73.52

related to it that i don't think we

75.759

covered

76.799

specifically enough

78.64

has to do with for loops

80.799

but then there are some other things

82.64

that

84.56

i think i may have underestimated

87.28

uh or i could potentially be

88.64

underestimating what people know

90.56

so

91.6

it's good to make sure you're clear on

93.68

it

95.439

the first of those

97.28

is the idea of immutable versus

99.52

immutable

100.64

objects

103.119

the key in python is to know that

106.72

native types

108.159

integers doubles times strings those are

111.84

all immutable booleans they are

114.24

immutable

115.36

tuples and ranges also are immutable

119.2

other things are

121.28

mutable not immutable so

123.84

a list a dictionary those things are

126.399

immutable

128.399

the difference between them

130.959

the concept of mutable versus immutable

134.4

is that

135.76

either

137.04

the memory stamp where something exists

140.239

changes or it does not

142.8

so if you were to

144.4

for example

146.16

let's just sort of say let's say that

147.84

you've got

150

in memory

151.68

you've got this thing uh abcd that's a

154.72

string

155.599

okay

156.72

and this is uh in memory

159.599

slots

160.879

and what is that 0 through 3 for those

165.68

and then you and let's say you assign a

167.68

variable let's say x equals

170.8

that string

173.92

then that means that x is a pointer

177.2

to

179.04

basically zero

181.44

and then there's going to be something

182.56

to let you know when it's done you know

184.8

i don't want to get too complicated into

186.48

it

187.599

now

188.72

if you assign x equals

191.68

let's say x y z

194.64

then what's going to happen in this case

197.2

is that

198.64

abcd

200.239

is not going to ex going to change

203.04

there now is going to be

206.4

there's going to be let's say at 567

209.92

you're going to have xyz

213.599

and memory slots

217.599

five through seven

219.92

right four five six seven yes

223.519

and that memory slot four is probably

225.36

going to be a string terminator

228.319

it gets into pointer arithmetic a little

230

bit that

230.879

you may or may not have been exposed to

234.4

if it is

236

mutable that would mean that instead

238.64

what would happen is

240.56

that abcd would be essentially

243.84

overwritten

247.599

as opposed to here where it's

250.4

saying it's a string so that string

252.84

exists and

255.439

this variable points to it

257.6

here

258.479

i'm going to create another string

259.919

somewhere in memory and then point the

261.44

variable to it i'm not going to override

264

the memory for the string

265.759

and that works for any of the native

268.88

types and tuples and ranges

273.28

that's really what you need to know

274.72

because there are like a couple of

276.4

questions related to that

278.56

and i just i know i have not really

281.12

haven't really covered that at all so i

282.639

want to make sure that we brought that

283.919

up

286.32

similarly

288.32

i want to make sure you understand one

290

of the things that i saw that

292.56

sparked this idea is

295.12

understanding

296.639

powers

298.479

exponent exponents

300.479

so x to the y

303.68

and that one

305.44

let me move this

310.479

and let me do

316.96

i think it's easier to show some

318.8

examples

320.56

so

322.24

i'm going to take a bunch of these

326.479

these are all going to be strings so i'm

328

going to do it this way

332.32

i want to show you something here so if

334.16

i do 0

335.52

to the 0 power

337.52

0 to the 1 power

340.479

and 0 to the second power

343.36

and now let me take

345.039

3 to the 0 power

348.639

10 to the 0 power

351.12

and this number

353.84

to the 0 power

357.759

so let's look at those first

364.24

and we'll see

365.68

zero to the zero

367.44

is one as is three to zero ten to the

370.8

zero or this big number zero

373.44

anything to the zero power

384.88

or z power if you say it that way

387.919

is equal to

389.759

one

391.6

that includes

393.199

zero

396

other than that

400.4

other than

402

that

404.8

zero

406.24

to any power

408.88

is 0.

413.36

and so if i even do

415.36

0 to the

418.24

negative 74th power

421.52

i think it'll read that right hopefully

423.199

it will no uh

427.36

i think i need to do it that way

432.88

oh it says it cannot be raised to a

434.639

negative power so if you go to zero to

436.479

the negative power

438.479

is going to give you

441.36

an exception

444.08

which you may have to run into

446.56

let's go any other number

452.72

uh oops

454.16

so i can't do that

457.599

but i can now

459.919

do this and it's just going to give you

461.36

it so 0

463.44

and let's do that

469.36

0 to a negative

472.24

is an exception we'll say

474.479

it cannot calculate

476.879

but it can anything else

480.479

i think that's important because they do

481.759

have some questions related to those

483.84

and we've not really you know just sort

485.759

of assumed that you understood exponents

489.84

and if you're a little fuzzy with them

491.36

especially

493.039

these little rules

494.8

it's good to know

496.96

now

498.08

another thing we haven't talked about is

499.919

we've done prints

502.319

p-r-i-n-t-s

504.479

we have done print commands

507.68

but there are two things we've not

508.72

talked about

510.08

we have not talked about the sep

513.36

nor have we talked about

517.039

the end

522.719

and let's just do a

533.6

so normally when we print

536.16

we print and it just it gives us a new

538.08

line

539.6

so see here that

541.2

we just get a

543.04

a new line here

544.88

um

546.64

i don't want to do that

552

yeah i'll do that for now

555.519

let's do this the ends first

558.72

let's throw it through this so what i'm

560.56

going to do here so now if i do the one

562.56

two three with an end and then end on an

565.279

a

566.88

let's look at those

571.2

so

572.48

here um

574.16

i do

576.8

this gets hard to read example two

582.399

example one

586.88

and let's do

588.959

of this

591.279

and we're gonna put an extra little one

593.04

here

594

just to be sure

595.44

okay so now let's look at it

597.68

so if you look here example one

600.88

it prints but notice that it does not do

605.76

now instead

607.12

so instead of the end

610.64

being an end line which we would have

613.04

here

614

so if we get rid of this guy

617.6

and run it we're gonna see what looks

619.6

more familiar see we see the uh one two

621.92

three because it's doing

623.92

you can do commas uh you can do multiple

625.76

items within your print so it's gonna do

627.36

those and it just prints them all in one

628.64

line

629.44

and it gives us a line feed

631.6

if i say don't do that whoops

633.76

if i say don't do that

635.519

and do an end

638.24

now

639.76

that one two three

641.92

notice

643.519

it does have a little space between

644.959

those so it shows us that that's a set

646.72

essentially that's different items

649.2

and

650.48

the end now is only

653.2

on a you know an empty string so what

655.279

the end thing is

657.04

an empty string it's not

659.04

a return

660.88

so

662

it doesn't give us that line feed and

663.68

then it dives right into

665.68

example two

668.079

notice here

669.76

and this is just to be clear on it so

672

at the end of the line here instead of

674.8

adding a blank i'm going to add an a

677.04

so here it does 1a to a 3a and it still

680.16

does those little spaces to split

682.8

the

684

list essentially

685.92

and then at the end of line it does an a

688.24

so i could also do like i can do end of

690.32

line

692.959

and it'll come back with an eol there

695.68

you go

698.48

so end tells me what i want to put at

700.48

the end of my line if i want to change

702.16

something around a little bit this is

703.839

very important if you're doing like

705.6

comma separated lists or something like

707.04

that

707.839

and so for example let's take the same

710.32

thing

711.44

and i think i've got yeah

716.16

so now

722.639

let's do this

728.639

i'm just going to print

731.04

so i get space

733.04

and let's look at these now let's look

734.48

at the set

735.68

now set matters only if i've got a

738.24

series so if i look at this first one

740.16

that 1 2 3

741.76

that's where it's at that separator is a

744.24

empty string so now instead of the space

746.959

which is the default

748.639

it crams them together here i use a sep

751.279

of hashtag

752.88

and you can see here where it puts a

754.32

hashtag at the end of each of those

757.36

and so that would commonly be where like

759.519

let's say i wanted to do a pipe

760.88

delimited

762.399

thing that would build out my list of

765.12

items

769.92

and i now get a pipe delimited

773.519

series of items however uh if i do

778.079

i have a list floating around here

779.2

somewhere

780.399

i don't

782.72

so let's do one more thing and let's do

785.6

uh my list equals

789.279

one comma two comma three

794.56

and now let's do

796.399

my list

799.76

with a separator of a pipe

804.56

and notice

806.72

that it doesn't separate because the

808.399

list is printing out the whole list

810.8

it's not doing anything special with it

813.44

therefore

815.6

we're getting this

817.44

uh this is what we're getting

819.839

because we're getting the list in the uh

821.839

sort of the string representation of the

823.44

list

824.72

so we would have to and

826.639

uh

827.6

similarly just to be clear if i do 4x

831.92

in my list

836.16

and then let's just do

838.16

let's do here let's just do print

841.36

x comma separator equals this thing

850.399

then i'm still not going to get what i

852.079

want

854.399

so it prints each of these because the

856.16

separator doesn't print it's only

857.68

between items so what i would have to do

860.72

is i would have to change it to be this

864.24

and then

866.24

i'm going to get my one two three but

867.519

then i've got that extra one at the end

869.44

so you know you've got a couple

870.8

different ways to get to it but

872.639

particularly doing a series of things

874.32

you can play around with separators we

876.24

didn't see it very often but it does

877.6

show up in the test

879.36

apparently and the ends is good to know

882.72

and we haven't played around with that

885.199

so i want to like take a look at those

886.639

two

887.76

uh let's see so this

889.76

i wanted to look specifically

894.639

let's see there's my list okay so let's

896.24

move this down oh let's do this first

899.36

uh one thing we didn't talk about before

908.16

there we go

910.399

i think we specifically spent enough

912

time in

913.44

what you do if you come back if you grab

916.32

4x in sample where sample is a

918.88

dictionary

920.32

and that is that it is a key

924.639

so if we print

926.72

and it's home one two three the three

928.959

items are home and an address office and

931.12

an address bill in an address if we

933.36

print the sample itself

937.44

uh

938.88

it is

940.88

here oh yeah because i don't have the

942.88

line so it just gives us a nice string

945.04

representation of it that we see here

947.36

if we do

948.48

samples dot keys

950.32

then it gives us

952

a collection of dictionary keys with

953.68

those three

955.279

keys if we do val if we do sample.values

959.04

and you guys will have seen this before

960.639

we did the dictionary example

963.199

we get the three values

965.199

if we do

966.72

for x and sample it's going to go

968.639

through the key so you see the keys here

971.12

home office and bill

972.88

well x is home office and bill

976.399

so if we wanted to print the items from

978

here we would actually do

980.079

a sample sub x

983.92

will give us those three addresses

988.56

so let's see you go there we get our

990.16

three addresses so reminder that if you

992.16

do a 4x in a dictionary it's not giving

994.639

you the objects the pairs it's giving

997.6

you the keys

1002.399

now if you want to do

1007.839

so if i do x comma y and let's do

1010.959

k comma value

1013.279

and sample

1014.56

then i can print

1017.36

k

1018.079

is

1022.8

plus k

1025.199

and v is

1027.439

this v

1030.64

i don't think we've played with this one

1032.079

too much

1035.28

too many values unpack in this case

1037.439

because

1038.48

it's only giving me keys

1040.64

but if i were to do

1044.48

uh

1045.28

let's do

1050.16

because it's not what i want is not key

1052

value pairs so if instead i do let's do

1055.28

sample 2.

1057.52

and here

1062.4

so i can come in here and i can see that

1065.679

k

1066.559

is what i'm assigning the first value

1069.36

home office bill v is what i'm assigning

1072.08

the second value in each of those three

1074.32

addresses

1075.919

and so i could make that very

1077.039

complicated i could have three or four

1078.24

items and i can assign all of them out

1081.679

i can also do this with classes so there

1083.919

are a lot of things i can do where i can

1085.52

be i can break something out

1088.559

basically within a loop and assign out

1090.08

some values all at the same time we

1092.799

don't really cover that so i want to

1093.919

make sure that we did touch into that

1095.919

one

1097.76

and then another one i want to make sure

1099.679

i get into

1101.36

is um

1105.6

well first off let me do this one

1107.2

because this is a quick one so if i look

1108.48

at sample two

1110.88

if i do

1113.36

print sample two

1117.52

but i do

1118.96

print

1121.12

let's do sample three

1127.679

equals sample two

1132.96

and then i do a sample

1136.64

two

1143.84

now let me see

1145.44

sorry

1146.4

if i did delete sample two

1150.16

and we'll leave it there so first let's

1151.679

just do this

1152.799

so i'm going to delete sample 2 item i'm

1155.12

going to do negative 1

1156.72

and then i'm going to print sample 2

1157.84

again

1160

let's just do it that way that's going

1161.28

to be the easiest way to show this

1165.36

and so what i get here

1168.48

is

1169.84

i'm not able to do it but if i do 0 to

1173.36

negative 1

1174.16

[Music]

1176.32

oh shoot i want it that's not how i want

1178.559

to do it anyways let me do this so if i

1180.64

do 0 to negative 1 that's 1 i want to

1182.72

see

1185.36

because you will see that so

1187.36

um

1190.4

let's see so i come through vs answer so

1192.88

i come here here's the whole thing

1196.08

but if i go zero to negative one it's

1198.16

going to build out it gets rid of the

1200.48

last item if i go zero to negative two

1204.72

see it starts it it's going to end up

1207.6

and it deletes

1215.679

yeah so it deletes the first one

1219.44

if you notice here

1222.64

if i do negative one

1224.559

actually let me do this this way it's

1225.919

gonna be easier to compare these two so

1228.4

i wanna compare these two so if i go

1229.679

zero to negative one blah

1233.52

i'll blah

1234.08

sample two

1236.48

let's do this

1238

sample three equals

1242.24

sample two well

1246.32

and then i'm going to try through all

1247.76

that and then i'm going to do

1251.44

2 equals sample 3 so i'm going to

1253.44

rebuild that

1255.28

all right so now look

1259.6

and note

1267.919

that

1270.24

i lost it okay

1272.48

so print sample two i do that if i

1275.52

delete that and present sample two

1278.4

then i get

1280.799

this guy that's the only one that's left

1284.559

and if i come in here

1287.28

go zero to negative two so let me do

1289.28

this

1291.679

because it's gonna be easier

1296.559

let's just do this

1304.4

sorry

1310.64

okay here we go

1313.2

so sample two if i go from zero to

1316

negative one

1317.6

that's where i start

1319.919

it gets rid of

1324

this guy

1325.679

and this guy

1328

i'm sorry this this guy and this guy

1331.679

if the range goes from zero to negative

1333.44

two

1335.919

then he gets rid of just this guy

1340.48

because now he hasn't run around enough

1343.44

but if i started with zero negative two

1348.32

oh that is what i did okay

1350.799

is that uh note that i'm losing

1355.039

this guy

1356.96

in each case if i go zero to negative

1359.12

four

1362

in this case

1363.919

i end up getting rid of nothing

1366.08

because i can't go to that it's an

1367.36

invalid range

1370.799

if i do negative

1373.84

well

1378.96

it pulls the last item off if i do

1380.799

negative two

1384.799

it's going to pull the middle item off

1388.4

so baker street disappears

1390.48

so if i go negative on it then

1393.52

it's going to go it starts up here and

1395.44

then it counts backwards so you can get

1396.72

some sort of funky kind of stuff that

1398.24

goes into it

1401.2

so remember your negatives start

1402.48

essentially your negatives start at the

1403.6

right versus the left

1407.36

now they do have i want to throw this

1409.36

this one out there just to sort of walk

1410.96

through something

1412.4

they have this very complex question

1414.4

which is this guy it basically says how

1416.48

many stars are printed

1418.48

the key

1420.159

is this thing

1421.76

is we've got this for c uh c for c in

1424.24

range r which is

1426.08

right a list for r in range

1428.84

three so

1433.36

if we just do

1441.679

the four r in range 3 we know that

1444.24

that's going to be 0 1 2 right so if we

1446.32

go look we'll see that that is 0 1 and

1449.2

2.

1451.12

now this is where it becomes complicated

1453.919

so

1457.76

it's going to create this set

1460.72

where

1462.159

c is in range

1463.919

r but r is 0 1 and 2.

1466.88

and so the set

1468.32

is going to be in the first one the

1469.76

range 0 we don't do anything at all so

1472.24

the set is an empty set

1475.12

when you do range one

1479.039

oh let me do this

1482.96

when you do range one

1486.48

then it's gonna be uh

1488.64

zero to one

1489.919

and so

1491.12

you're gonna come here you're gonna get

1492.32

once and then it's gonna be zero is the

1494.48

only thing that's gonna be in there

1496.159

two the items in the range are zero and

1498.799

one so that's your sets

1501.52

and then it comes out and says okay for

1503.279

x and list

1504.72

and list is this thing so the list items

1506.48

are empty set

1507.84

set with zero and a set with zero one

1511.12

and so it's going to come in an empty

1512.48

list and it's going to say for y and x

1514.72

so there's nothing there it's an empty

1516.32

set so nothing happens

1518.32

the next time through it comes for 0

1521.2

if 0 is less than 2 prints star yes it

1523.6

does the next time it comes through and

1525.679

it's going to go 0 zero is less than two

1528.08

print star

1529.6

and then one one is less than two print

1531.919

star and so in the end it's going to

1534.48

print three stars

1536.799

so it's very very complicated

1539.12

looking

1541.039

but not terribly so

1543.36

oh and that reminds me one other thing

1544.88

because of order operations

1546.88

um another thing to remember is that if

1549.36

you do

1550.72

exponents

1552.159

those are not left to right so if i go 2

1554.48

to the 3 to the 2

1557.52

or let's say to the 4.

1560.799

i don't do 2 to the 3 which is 8 and

1563.2

then 8 to the 4th which is what is that

1565.36

256.

1566.96

instead i do 3 to the 4th which is 81

1570.64

and then 2 to the 81 and that's going to

1572.64

be a huge number so if i do this

1575.679

perform that x let's just do this here

1581.44

and so it's going to be a huge number

1584.48

not 256. yeah so it's a huge number

1588.159

which is not the same

1590.08

as if i do this

1594.96

oh i'm sorry it's not the same as if i

1596.72

do this let me change the

1599.919

order of operation

1604.72

with 4096.

1607.12

so you go from the outside first so the

1609.2

right to the left when you're doing

1610.84

exponents as far as order of operations

1614.96

they'll do for this first part i only

1616.48

this is only actually covering the first

1617.76

half of the test as i went through it

1619.2

and wanted to bring had some notes on

1620.72

some additional things i wanted to bring

1622.4

up

1623.12

i apologize for maybe not being as clear

1625.52

or not getting into some of these before

1627.679

but i'm going to continue with this i'm

1629.44

going to go take a look at the second

1630.559

half of the test and see what kind of

1632.32

notes i have that come out of that as

1634.4

we're getting pretty darn close we are

1636.32

almost there so

1638.24

you can see all of this out in the

1640.159

repository github repository where we

1642.24

have links in the show notes

1644.159

i'll get that caught up and uh go out

1646.96

there have yourself a great day a great

1648.72

week and we will talk to you

1650.799

next time

1667.36

you