text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
like that yourself it's a lot easier to
158
4
stand on the shoulders of others who've
160.4
3.52
already solved that problem for you so
162
3.84
you can focus on the problem that you
163.92
4.399
yourself want to solve so for
165.84
5.119
documentation on most any python module
168.319
4.56
you go to the official python docs and
170.959
3.761
you go to a url like this where the
172.879
4
documentation for that specific module
174.72
4.159
lives and within the documentation
176.879
3.521
you'll see a list of the functions or
178.879
3.44
other functionality that some module
180.4
4.479
provides but how do you go about loading
182.319
4
a module
184.879
3.44
into your own program so that you can
186.319
4.321
use the functions in that module well we
188.319
4.801
need a new keyword in python and namely
190.64
5.92
its import the import keyword in python
193.12
6.8
allows you to import the contents of the
196.56
4.72
functions from
199.92
4.319
some module in python well how might i
201.28
4.879
go about using this in practice well let
204.239
4.161
me propose that there exists in that
206.159
4.881
random module this function among others
208.4
4.24
so i have copied and pasted from the
211.04
3.199
documentation
212.64
2.48
this
214.239
3.92
summary of a function called choice now
215.12
6.56
the function exists in the random module
218.159
6.08
so to speak not a random module the
221.68
4.639
random module and so generally the
224.239
4
documentation describes it fully like
226.319
2.601
this
228.239
2.64
random.choice is how you would
228.92
3.399
technically call this function though
230.879
3.28
we'll see alternatives to that in
232.319
4.161
parentheses there is a parameter called
234.159
5.28
seq for sequence and sequence generally
236.48
5.28
means a list or something that is list
239.439
4.16
like if you have a list of numbers or
241.76
3.44
strings or anything else and the
243.599
3.84
documentation elaborates well how can i
245.2
4.08
go about using this function to solve
247.439
3.761
perhaps a familiar problem well let me
249.28
4
go ahead and open up vs code here and
251.2
3.759
let me propose that we implement a
253.28
4.4
program that simulates flipping a coin a
254.959
5.68
coin that in the us heads heads or tails
257.68
6.079
the idea of which is to pick a decision
260.639
6.081
with 50 50 probability 50 probability of
263.759
5.681
heads 50 probability of tails or you can
266.72
4.72
use some other mechanism like that well
269.44
4
let me go ahead and open a program with
271.44
4.479
code called generate dot pi because i
273.44
4.08
want to start generating a whole bunch
275.919
3.601
of random information the first of which
277.52
3.92
is just going to be a coin toss now how
279.52
4.399
do i go about using that function well i
281.44
5.12
first have to import the random library
283.919
4.161
so literally the first or among the
286.56
4.16
first lines of my file should be import
288.08
4.8
random and that just gives me access to
290.72
4.4
all of the functions in that specific
292.88
5.84
module now suppose i want to flip a coin
295.12
6.32
well i can do random dot choice per the
298.72
4.8
documentation a moment ago and that
301.44
4.16
again takes a sequence what's a sequence
303.52
3.6
it's a list or something that's list
305.6
3.68
like and we know about lists we've used
307.12
4.079
lists to iterate over numbers we've used
309.28
3.28
lists to iterate over students at
311.199
3.361
hogwarts let's go ahead now and let's
312.56
4.639
iterate over just a list of two sides of
314.56
6.079
a coin heads quote unquote or tails now
317.199
5.121
i could call these anything i want these
320.639
4.081
are my strings i just want to simulate a
322.32
3.84
tossing a coin so i'm just going to say
324.72
3.919
in all lower case heads and tails but
326.16
4.96
notice the syntax i have heads and tails
328.639
3.84
and double quotes that's because they're
331.12
3.2
strings i could also use single quotes
332.479
3.521
so long as i'm consistent there's a
334.32
3.2
comma between them which means the list
336
4.24
has two elements there's square brackets
337.52
4.64
to the right and the left which
340.24
3.92
indicates that this is indeed a list
342.16
4.08
that's the syntax recall for defining a
344.16
4.08
list in python and then lastly there's
346.24
3.36
something more familiar there's the
348.24
3.36
parentheses outside of those square
349.6
3.039
brackets but those are just the
351.6
3.12
parentheses that belong to the choice
352.639
4.801
function and specify where its parameter
354.72
5.28
gets passed in but again unlike past
357.44
6
functions i have to specify what module
360
5.52
this function is in at least for now and
363.44
4.64
so i do random dot choice to call this
365.52
4.32
specific function all right well it's
368.08
3.92
one thing to flip a coin picking between
369.84
3.52
those with 50
372
2.4