text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
know it really isn't valid yeah thank
251.319
4.601
you uh well pleas to you can type just
253.879
4.88
to science science and that's it and it
255.92
5.8
still be valid still be valid according
258.759
5.841
to your program but the same exactly
261.72
5.199
we've set a very low bar here in fact if
264.6
4.76
I go ahead and rerun python of validate
266.919
4.201
and I'll just type in one add sign
269.36
4.2
that's it no username no domain name
271.12
3.88
this doesn't really look like an email
273.56
3.72
address but unfortunately my code thinks
275
3.72
it in fact is because it's obviously
277.28
3.759
just looking for an at sign alone well
278.72
4.319
how could we improve this well minimally
281.039
4.641
an email address I I think tends to have
283.039
3.641
though this is not actually a
285.68
3.2
requirement tends to have an at sign and
286.68
4.239
a single dot at least maybe somewhere in
288.88
5.48
the domain name so mailen harvard.edu so
290.919
5.081
let's check for that dot as well though
294.36
3.52
again strictly speaking doesn't even
296
3.84
have to be that case but I'm going for
297.88
3.4
my own email address at least for now as
299.84
3.199
our test case so let me go ahead and
301.28
3.84
change my code now and say not only if
303.039
6.72
at is an email but also uh dot is in
305.12
7
email as well so I'm asking now two
309.759
4.921
questions I have two Boolean Expressions
312.12
5.4
if at in email and I'm anding them
314.68
5.16
together logically this is a logical and
317.52
4.32
so to speak so if it's the case that at
319.84
5
is an email and Dot is an email okay now
321.84
4.88
I'm going to go ahead and say valid all
324.84
3.6
right this would still seem to work for
326.72
3.44
my email address let me go ahead and run
328.44
5.44
python of validate dopy maen harbor. edu
330.16
5.72
enter and that of course is valid as
333.88
4.36
expected but here too we can be a little
335.88
3.92
adversarial and type in something
338.24
3.6
nonsensical like at Dot and
339.8
3.839
unfortunately that too is going to be
341.84
3.919
mistaken as valid even though there's
343.639
4.241
still no username domain name or
345.759
3.601
anything like that so I think we need to
347.88
4.599
be a little more methodical here in fact
349.36
6.76
notice that if I do this like this uh
352.479
5.84
the at sign can be anywhere and the dot
356.12
4.4
can be anywhere but if I assuming the
358.319
3.44
user is going to have a traditional
360.52
3.76
domain name like harvard.edu or
361.759
4.921
gmail.com I really want to look for the
364.28
5.039
dot in the domain name only not
366.68
5.48
necessarily just the username so let me
369.319
4.801
go ahead and do this let me go ahead and
372.16
4.599
introduce a bit more logic here and
374.12
5.84
instead do this let me go ahead and do
376.759
4.321
uh
379.96
4.239
email.it of quote unquote at sign so
381.08
6.04
email again is a string or a stir stirs
384.199
5
come with methods not just strip but
387.12
4.16
also another one called split that as
389.199
4.321
the name applies will split one stir
391.28
3.96
into multiple ones if you give it a
393.52
5.92
character or more to split on so this is
395.24
5.679
hopefully going to return to me two
399.44
3.199
parts from a traditional email address
400.919
4.161
the username and the domain name and it
402.639
4.601
turns out I can unpack that sequence of
405.08
5.36
responses by doing this username comma
407.24
6.12
domain equals this I could store it in a
410.44
5.12
list or some other structure but if I
413.36
4.16
already know in advance what kinds of
415.56
3.479
values I'm expecting a username and
417.52
3.32
hopefully a domain I'm going to go ahead
419.039
3.201
and do it like this instead and just
420.84
3.72
Define two variables at once on one line
422.24
4.04
of code and now I'm going to be a little
424.56
3.72
more precise if
426.28
6.24
username uh uh if username then I'm
428.28
7.12
going to go ahead and say print valid
432.52
5.32
else I'm going to go ahead and say print
435.4
4.68
invalid now this isn't good enough but
437.84
3.84
I'm at least checking for the presence
440.08
3.119
of a username now and you might not have
441.68
3.359
seen this before but if you simply ask a
443.199
4.4
question like if username and username
445.039
5.521
is a string well usern if username is
447.599
5.16
going to give me a true answer if
450.56
4.759
username is anything except none or
452.759
5.041
quote unquote nothing so there's a a
455.319
4.921
truthy value here whereby if username
457.8
4.36
has at least one character that's going
460.24
3.799
to be considered true but if username
462.16
4.24
has no characters it's going to be
464.039
5.44
considered a false value effectively but
466.4
4.32
this isn't good enough I don't want to
469.479
2.961
just check for username I want to also
470.72
4.72
check that it's the case that dot is in
472.44
5.52
the domain name as well so notice here
475.44
4.68
there's a bit of potential confusion
477.96
4.76