Library

Video Player is loading.
 
Current Time 0:00
Duration 1:24:01
Loaded: 0.00%
 

x1.00


Back

Games & Quizzes

Training Mode - Typing
Fill the gaps to the Lyric - Best method
Training Mode - Picking
Pick the correct word to fill in the gap
Fill In The Blank
Find the missing words in a sentence Requires 5 vocabulary annotations
Vocabulary Match
Match the words to the definitions Requires 10 vocabulary annotations

You may need to watch a part of the video to unlock quizzes

Don't forget to Sign In to save your points

Challenge Accomplished

PERFECT HITS +NaN
HITS +NaN
LONGEST STREAK +NaN
TOTAL +
- //

We couldn't find definitions for the word you were looking for.
Or maybe the current language is not supported

  • 00:00

    all right hello world this is cs50 live
    all right hello world this is cs50 live

  • 00:03

    my name is Colton Ogden today we're
    my name is Colton Ogden today we're

  • 00:04

    joined by the man himself
    joined by the man himself

  • 00:06

    David Malin hello everyone good to see
    David Malin hello everyone good to see

  • 00:08

    everyone on stream and not just in the
    everyone on stream and not just in the

  • 00:09

    chat today we are doing something pretty
    chat today we are doing something pretty

  • 00:12

    cool today pretty fun we're doing a from
    cool today pretty fun we're doing a from

  • 00:14

    scratch of Python tutorial and my
    scratch of Python tutorial and my

  • 00:16

    understanding is that you've actually
    understanding is that you've actually

  • 00:18

    brought some questions and topics
    brought some questions and topics

  • 00:21

    problem challenges that I haven't seen
    problem challenges that I haven't seen

  • 00:25

    that we're gonna implement and I'm gonna
    that we're gonna implement and I'm gonna

  • 00:26

    sort of be a proxy to somebody who maybe
    sort of be a proxy to somebody who maybe

  • 00:28

    is learning for the first time indeed so
    is learning for the first time indeed so

  • 00:30

    I'm gonna pretty much assume that Colton
    I'm gonna pretty much assume that Colton

  • 00:31

    may or may not actually know Python and
    may or may not actually know Python and

  • 00:34

    so along the way we'll try to solve some
    so along the way we'll try to solve some

  • 00:35

    problems actively by a coding we'll pull
    problems actively by a coding we'll pull

  • 00:37

    things up by Google or Stack Overflow as
    things up by Google or Stack Overflow as

  • 00:39

    we go and frankly try to approximate the
    we go and frankly try to approximate the

  • 00:41

    experience that Colton and I arguably do
    experience that Colton and I arguably do

  • 00:43

    every day when we're writing code to
    every day when we're writing code to

  • 00:45

    sort of figure out problems that we
    sort of figure out problems that we

  • 00:47

    cannot get solved sure I guess maybe we
    cannot get solved sure I guess maybe we

  • 00:49

    should start off first off by maybe
    should start off first off by maybe

  • 00:50

    explaining what Python is and the honest
    explaining what Python is and the honest

  • 00:52

    folks we've advertised this as sort of
    folks we've advertised this as sort of

  • 00:54

    an experience for people who may not
    an experience for people who may not

  • 00:56

    have even programmed or read but at
    have even programmed or read but at

  • 00:57

    least have not programmed in Python
    least have not programmed in Python

  • 00:58

    before yeah so why don't we assume that
    before yeah so why don't we assume that

  • 01:00

    no one here is really that familiar with
    no one here is really that familiar with

  • 01:03

    Python but if you are that's fine
    Python but if you are that's fine

  • 01:04

    hopefully we can fill in some gaps in
    hopefully we can fill in some gaps in

  • 01:05

    your knowledge stop us at any point via
    your knowledge stop us at any point via

  • 01:07

    the chat if you have a question there's
    the chat if you have a question there's

  • 01:09

    no dumb questions here if we take them
    no dumb questions here if we take them

  • 01:11

    for granted that you know what some top
    for granted that you know what some top

  • 01:12

    concept is or some function is or some
    concept is or some function is or some

  • 01:14

    feature just chime and say hey everyone
    feature just chime and say hey everyone

  • 01:16

    what what did they mean by that and so
    what what did they mean by that and so

  • 01:19

    that we can answer here on stream so
    that we can answer here on stream so

  • 01:21

    Python is a very popular programming
    Python is a very popular programming

  • 01:22

    language it's a little different from
    language it's a little different from

  • 01:25

    languages like C and C++ and a few
    languages like C and C++ and a few

  • 01:28

    others that you would traditionally
    others that you would traditionally

  • 01:28

    compile recall that if you've ever
    compile recall that if you've ever

  • 01:31

    programmed in one of those languages you
    programmed in one of those languages you

  • 01:32

    have to actually run some program called
    have to actually run some program called

  • 01:34

    a compiler to convert your source code
    a compiler to convert your source code

  • 01:36

    the text that you write to machine code
    the text that you write to machine code

  • 01:38

    the zeros and ones that the computer
    the zeros and ones that the computer

  • 01:40

    actually understands nice thing about
    actually understands nice thing about

  • 01:41

    Python is that we don't have to do that
    Python is that we don't have to do that

  • 01:43

    what would is you want to characterize
    what would is you want to characterize

  • 01:45

    Python for folks to distinguish it from
    Python for folks to distinguish it from

  • 01:46

    that process yeah no I mean Python is
    that process yeah no I mean Python is

  • 01:49

    nice it's it's essentially it runs
    nice it's it's essentially it runs

  • 01:51

    almost in this it's called a virtual
    almost in this it's called a virtual

  • 01:53

    machine but it's almost like having a
    machine but it's almost like having a

  • 01:54

    computer inside a computer and it
    computer inside a computer and it

  • 01:56

    executes these you know with the
    executes these you know with the

  • 01:58

    traditional programming language you're
    traditional programming language you're

  • 01:59

    writing text and I'll switch over to my
    writing text and I'll switch over to my

  • 02:01

    computer here just that we can maybe
    computer here just that we can maybe

  • 02:03

    frame this visually a little bit better
    frame this visually a little bit better

  • 02:05

    but not Chrome in BS code by the way
    but not Chrome in BS code by the way

  • 02:08

    this is my text editor of choice it just
    this is my text editor of choice it just

  • 02:09

    vs code you need in order to
    vs code you need in order to

  • 02:11

    any source code some sort of text editor
    any source code some sort of text editor

  • 02:14

    application you can even use something
    application you can even use something

  • 02:16

    like text edit for example if I pull it
    like text edit for example if I pull it

  • 02:18

    TextEdit on my Mac it's a I'm not sure
    TextEdit on my Mac it's a I'm not sure

  • 02:20

    what that email is there but I think
    what that email is there but I think

  • 02:23

    that might have been from another stream
    that might have been from another stream

  • 02:24

    but essentially what you do is you you
    but essentially what you do is you you

  • 02:26

    have some program that you can write
    have some program that you can write

  • 02:28

    text into and usually you don't want to
    text into and usually you don't want to

  • 02:30

    write it in what's called rich text or
    write it in what's called rich text or

  • 02:31

    you have formatting you write it in
    you have formatting you write it in

  • 02:33

    plain text like this and you write your
    plain text like this and you write your

  • 02:36

    instructions to the computer a bunch of
    instructions to the computer a bunch of

  • 02:37

    lines tell the computer icon
    lines tell the computer icon

  • 02:39

    no this isn't quite Python not unless
    no this isn't quite Python not unless

  • 02:43

    you're unless you don't know how to
    you're unless you don't know how to

  • 02:44

    write good variable names to say this
    write good variable names to say this

  • 02:46

    might look and this might be some
    might look and this might be some

  • 02:47

    people's Python code but you essentially
    people's Python code but you essentially

  • 02:50

    go through and you write a set of
    go through and you write a set of

  • 02:51

    instructions for the computer like this
    instructions for the computer like this

  • 02:53

    top down and the computer will execute
    top down and the computer will execute

  • 02:55

    them but computers don't understand
    them but computers don't understand

  • 02:56

    arbitrary textual information the
    arbitrary textual information the

  • 02:59

    computer can only speak in certain
    computer can only speak in certain

  • 03:00

    languages computer labs specifically its
    languages computer labs specifically its

  • 03:02

    own machine code which is binary code
    own machine code which is binary code

  • 03:04

    which we talked about in cs50 one of the
    which we talked about in cs50 one of the

  • 03:06

    more underlying principles of that David
    more underlying principles of that David

  • 03:08

    has an awesome chance of lectures on our
    has an awesome chance of lectures on our

  • 03:10

    YouTube channel
    YouTube channel

  • 03:11

    but long story short somewhere along the
    but long story short somewhere along the

  • 03:15

    line you have to convert all your
    line you have to convert all your

  • 03:17

    instructions into something that the
    instructions into something that the

  • 03:19

    computer can understand and with
    computer can understand and with

  • 03:20

    traditional language that you alluded to
    traditional language that you alluded to

  • 03:22

    before
    before

  • 03:22

    you do this with the help of a compiler
    you do this with the help of a compiler

  • 03:24

    they take this text and end up
    they take this text and end up

  • 03:26

    translating it into you know they
    translating it into you know they

  • 03:28

    basically this which is the computer's
    basically this which is the computer's

  • 03:30

    native sort of tongue mm-hmm but how is
    native sort of tongue mm-hmm but how is

  • 03:32

    Python different here python is
    Python different here python is

  • 03:33

    different in that it doesn't actually
    different in that it doesn't actually

  • 03:35

    perform this step explicitly along the
    perform this step explicitly along the

  • 03:38

    line it still actually happens but it
    line it still actually happens but it

  • 03:41

    basically translates all the lines that
    basically translates all the lines that

  • 03:43

    you've written when you just load the
    you've written when you just load the

  • 03:45

    script into the program that is itself
    script into the program that is itself

  • 03:47

    called Python yeah and you can think of
    called Python yeah and you can think of

  • 03:49

    Python then is an interpreter this sort
    Python then is an interpreter this sort

  • 03:51

    of middleman that translates between
    of middleman that translates between

  • 03:53

    what you write and what the computer
    what you write and what the computer

  • 03:54

    actually understands so you can think of
    actually understands so you can think of

  • 03:56

    Python the program which will run in
    Python the program which will run in

  • 03:57

    just a couple minutes is a program that
    just a couple minutes is a program that

  • 03:59

    reads your own code top to bottom left
    reads your own code top to bottom left

  • 04:01

    to right and it just does what you say
    to right and it just does what you say

  • 04:03

    you don't have to actually use something
    you don't have to actually use something

  • 04:05

    like Visual Studio or GCC or clang or
    like Visual Studio or GCC or clang or

  • 04:08

    any number of other compilers explicitly
    any number of other compilers explicitly

  • 04:10

    all of that sort of happens before you
    all of that sort of happens before you

  • 04:12

    automatically thanks to the
    automatically thanks to the

  • 04:13

    interpretation process along the way in
    interpretation process along the way in

  • 04:15

    D you can even fire up let's see if if
    D you can even fire up let's see if if

  • 04:18

    you have it installed on your machine
    you have it installed on your machine

  • 04:18

    for example here I have Python three
    for example here I have Python three

  • 04:21

    there's two different versions of Python
    there's two different versions of Python

  • 04:22

    3 long story short Python 3 is the new
    3 long story short Python 3 is the new

  • 04:24

    way
    way

  • 04:25

    the way that is going to be the official
    the way that is going to be the official

  • 04:27

    way very shortly as of 2020 but if I
    way very shortly as of 2020 but if I

  • 04:30

    type Python 3 and my command line
    type Python 3 and my command line

  • 04:32

    assuming you have it installed you can
    assuming you have it installed you can

  • 04:33

    see that I actually have this sort of
    see that I actually have this sort of

  • 04:35

    prompt here these three arrows which
    prompt here these three arrows which

  • 04:37

    append I can actually type in
    append I can actually type in

  • 04:38

    instructions and it will immediately
    instructions and it will immediately

  • 04:39

    execute things for example if I wanted
    execute things for example if I wanted

  • 04:41

    to say print David J Malan like like
    to say print David J Malan like like

  • 04:45

    this assuming that I type it correctly
    this assuming that I type it correctly

  • 04:47

    it'll actually literally do it without
    it'll actually literally do it without

  • 04:49

    needing to do that intermediary
    needing to do that intermediary

  • 04:50

    compilation stuff yeah absolutely this
    compilation stuff yeah absolutely this

  • 04:52

    is an interactive interpreter so we'll
    is an interactive interpreter so we'll

  • 04:54

    just do what you say the downside of
    just do what you say the downside of

  • 04:56

    course is that we're not really saving
    course is that we're not really saving

  • 04:57

    any of our work along the way so it's
    any of our work along the way so it's

  • 04:59

    better generally to write your programs
    better generally to write your programs

  • 05:00

    in an actual text editor like vs code or
    in an actual text editor like vs code or

  • 05:02

    sublime or atom or something else so
    sublime or atom or something else so

  • 05:05

    that you can save your code and let the
    that you can save your code and let the

  • 05:06

    interpreter run it and rerun it again
    interpreter run it and rerun it again

  • 05:08

    and again so why don't we go ahead and
    and again so why don't we go ahead and

  • 05:10

    do that you want to go ahead and open up
    do that you want to go ahead and open up

  • 05:11

    a blank editor window so for those of
    a blank editor window so for those of

  • 05:14

    you following along at home if you want
    you following along at home if you want

  • 05:15

    to go ahead and Google the S code or
    to go ahead and Google the S code or

  • 05:18

    Visual Studio code you're welcome to
    Visual Studio code you're welcome to

  • 05:20

    download the same program for free atom
    download the same program for free atom

  • 05:22

    sublime text and notepad plus plus and a
    sublime text and notepad plus plus and a

  • 05:25

    bunch of others are very popular on Macs
    bunch of others are very popular on Macs

  • 05:27

    and PCs and Linux machines but odds are
    and PCs and Linux machines but odds are

  • 05:29

    if you're tuning in you probably have
    if you're tuning in you probably have

  • 05:31

    some form of text editor but if not feel
    some form of text editor but if not feel

  • 05:33

    free to try one of those and then what
    free to try one of those and then what

  • 05:34

    you should also do if you don't have it
    you should also do if you don't have it

  • 05:36

    already is make sure your computer if
    already is make sure your computer if

  • 05:37

    you do want to follow along has Python
    you do want to follow along has Python

  • 05:39

    installed
    installed

  • 05:40

    so again python is not only a language
    so again python is not only a language

  • 05:41

    it's an interpreter a program that will
    it's an interpreter a program that will

  • 05:44

    understand your use of that language and
    understand your use of that language and

  • 05:46

    if you go to python org slash downloads
    if you go to python org slash downloads

  • 05:48

    you'll find yourself at the official
    you'll find yourself at the official

  • 05:50

    website where you can download the
    website where you can download the

  • 05:51

    python version 3 installer to make sure
    python version 3 installer to make sure

  • 05:54

    that you have that on your machine
    that you have that on your machine

  • 05:56

    depending on how your machine was
    depending on how your machine was

  • 05:57

    configured you may have Python already
    configured you may have Python already

  • 05:59

    as Colton said but it might be an older
    as Colton said but it might be an older

  • 06:00

    version Python 2 that's officially going
    version Python 2 that's officially going

  • 06:03

    to be end-of-life soon that is it's
    to be end-of-life soon that is it's

  • 06:05

    being phased out in favor finally of
    being phased out in favor finally of

  • 06:07

    Python 3 so everything we do today is
    Python 3 so everything we do today is

  • 06:09

    Python 3 specific but beware because
    Python 3 specific but beware because

  • 06:11

    when you're googling when you're looking
    when you're googling when you're looking

  • 06:12

    on Stack Overflow there's a lot of good
    on Stack Overflow there's a lot of good

  • 06:14

    answers to old Python code out there so
    answers to old Python code out there so

  • 06:17

    you don't want to be led astray
    you don't want to be led astray

  • 06:18

    Simo has a sweet comment says david
    Simo has a sweet comment says david

  • 06:20

    because of you i stopped playing video
    because of you i stopped playing video

  • 06:22

    games all day I learned it
    games all day I learned it

  • 06:23

    have a real job at an ecomcon wow that's
    have a real job at an ecomcon wow that's

  • 06:25

    amazing I see Andres taking exception to
    amazing I see Andres taking exception to

  • 06:28

    the fact that we haven't promoted Idol
    the fact that we haven't promoted Idol

  • 06:29

    there's a few other IDE s and editors as
    there's a few other IDE s and editors as

  • 06:32

    well this is not an exhaustive list
    well this is not an exhaustive list

  • 06:34

    what's nice about things like vs code is
    what's nice about things like vs code is

  • 06:36

    that they are first and foremost a text
    that they are first and foremost a text

  • 06:38

    editor and you can layer more features
    editor and you can layer more features

  • 06:40

    on top of them somebody asked out what
    on top of them somebody asked out what

  • 06:42

    the s code am I using I think I'm using
    the s code am I using I think I'm using

  • 06:43

    Dracula right now it's just at the end
    Dracula right now it's just at the end

  • 06:45

    of the last stream but I actually prefer
    of the last stream but I actually prefer

  • 06:46

    the noctus theme so look real quick just
    the noctus theme so look real quick just

  • 06:49

    the important stuff out of the way first
    the important stuff out of the way first

  • 06:51

    this has nothing to do with Python but
    this has nothing to do with Python but

  • 06:53

    we're gonna switch that Noctis color
    we're gonna switch that Noctis color

  • 06:55

    that's the one that I recently have like
    that's the one that I recently have like

  • 06:56

    but they all a lot of the defaults look
    but they all a lot of the defaults look

  • 06:58

    very nice nice and you want it let's go
    very nice nice and you want it let's go

  • 06:59

    ahead and get rid of the Explorer for
    ahead and get rid of the Explorer for

  • 07:00

    now but let's just go ahead and save
    now but let's just go ahead and save

  • 07:02

    this program as hello dot pi so hello is
    this program as hello dot pi so hello is

  • 07:05

    gonna be the name of the program pi
    gonna be the name of the program pi

  • 07:06

    indicates that this is a Python program
    indicates that this is a Python program

  • 07:08

    you don't need number three anywhere in
    you don't need number three anywhere in

  • 07:10

    there you still just use dot pi so our
    there you still just use dot pi so our

  • 07:12

    first program well let's keep it super
    first program well let's keep it super

  • 07:14

    simple and literally write the program
    simple and literally write the program

  • 07:15

    that everyone in the world seems to
    that everyone in the world seems to

  • 07:17

    start writing code in which is just
    start writing code in which is just

  • 07:19

    hello world so instead of David J Malan
    hello world so instead of David J Malan

  • 07:20

    how would you go ahead and Python and
    how would you go ahead and Python and

  • 07:22

    just write a program that prints out
    just write a program that prints out

  • 07:24

    literally hello world
    literally hello world

  • 07:26

    I would I would use the print function
    I would I would use the print function

  • 07:27

    which comes with Python and actually the
    which comes with Python and actually the

  • 07:30

    nice thing about vs code is that it
    nice thing about vs code is that it

  • 07:32

    gives you a lot of this sort of built-in
    gives you a lot of this sort of built-in

  • 07:34

    intelligence depending on how you like
    intelligence depending on how you like

  • 07:36

    to develop or it will actually tell you
    to develop or it will actually tell you

  • 07:37

    when you write functions you know sort
    when you write functions you know sort

  • 07:40

    of what the function it what the
    of what the function it what the

  • 07:41

    function expects what it does so this is
    function expects what it does so this is

  • 07:43

    a nice thing about modern text editors
    a nice thing about modern text editors

  • 07:44

    and integrated development environments
    and integrated development environments

  • 07:46

    IDE using and you said hello world so
    IDE using and you said hello world so

  • 07:48

    I'm just gonna type in the string hello
    I'm just gonna type in the string hello

  • 07:51

    world and that's it yeah but some and
    world and that's it yeah but some and

  • 07:54

    you'll notice now that you get syntax
    you'll notice now that you get syntax

  • 07:56

    highlighting with programs like this I
    highlighting with programs like this I

  • 07:57

    see there's a shout-out to Pi charm as
    see there's a shout-out to Pi charm as

  • 08:00

    well which is a popular editor for
    well which is a popular editor for

  • 08:01

    Python as well yes we do know that IO
    Python as well yes we do know that IO

  • 08:04

    might come with the default installation
    might come with the default installation

  • 08:05

    but we're just we're just focusing on
    but we're just we're just focusing on

  • 08:08

    Python today you can use any text editor
    Python today you can use any text editor

  • 08:09

    out there that you would like it's
    out there that you would like it's

  • 08:11

    amazing folks in the chat are actually
    amazing folks in the chat are actually

  • 08:12

    typing typing some responses to what you
    typing typing some responses to what you

  • 08:15

    said in is that actually this is kind of
    said in is that actually this is kind of

  • 08:17

    interesting because garage burrs wall
    interesting because garage burrs wall

  • 08:18

    actually says print hello world and if
    actually says print hello world and if

  • 08:21

    I'm if I'm reading that correctly
    I'm if I'm reading that correctly

  • 08:22

    he actually said or he or she actually
    he actually said or he or she actually

  • 08:25

    said hello world now if we try to do you
    said hello world now if we try to do you

  • 08:27

    think we should try and run this and
    think we should try and run this and

  • 08:29

    I don't like the squigglies things I
    I don't like the squigglies things I

  • 08:31

    suggest that there's a mistake of some
    suggest that there's a mistake of some

  • 08:32

    sort
    sort

  • 08:32

    so okay undefined variable hello and
    so okay undefined variable hello and

  • 08:35

    this says unexpected token world
    this says unexpected token world

  • 08:37

    interesting
    interesting

  • 08:38

    so let's come let's come back to that
    so let's come let's come back to that

  • 08:40

    though because I think we should run the
    though because I think we should run the

  • 08:41

    program first because while we have
    program first because while we have

  • 08:42

    arguably written a program now we
    arguably written a program now we

  • 08:44

    haven't actually run it previously when
    haven't actually run it previously when

  • 08:46

    Colton ran the program called Python 3
    Colton ran the program called Python 3

  • 08:49

    he was able to write a line of code hit
    he was able to write a line of code hit

  • 08:50

    enter and immediately was executed but
    enter and immediately was executed but

  • 08:53

    typically the paradigm of course for
    typically the paradigm of course for

  • 08:54

    writing code is to write one or more
    writing code is to write one or more

  • 08:56

    lines of code save it in a file and then
    lines of code save it in a file and then

  • 08:58

    somehow execute that file so I think to
    somehow execute that file so I think to

  • 09:01

    execute this file hello dot pi we're
    execute this file hello dot pi we're

  • 09:02

    gonna need a terminal window sure how do
    gonna need a terminal window sure how do

  • 09:04

    we do this so I already have one so this
    we do this so I already have one so this

  • 09:06

    is the Mac native terminal application
    is the Mac native terminal application

  • 09:08

    windows has the same thing with CMD
    windows has the same thing with CMD

  • 09:10

    linux i actually know what's called on
    linux i actually know what's called on

  • 09:12

    linux what's it called of linux terminal
    linux what's it called of linux terminal

  • 09:14

    terminal or x term or any a bunch of
    terminal or x term or any a bunch of

  • 09:16

    other things and so I'm actually I'm
    other things and so I'm actually I'm

  • 09:18

    still in the Python show I'm gonna clear
    still in the Python show I'm gonna clear

  • 09:20

    my screen and then this is assuming that
    my screen and then this is assuming that

  • 09:22

    I'm actually in the directory where
    I'm actually in the directory where

  • 09:23

    we're doing this code so right now we
    we're doing this code so right now we

  • 09:26

    are at my I believe dev is that PWD that
    are at my I believe dev is that PWD that

  • 09:30

    tells you where you're working yeah so
    tells you where you're working yeah so

  • 09:32

    this is per present working directory
    this is per present working directory

  • 09:34

    I'm here users J Harvard dev I want to
    I'm here users J Harvard dev I want to

  • 09:37

    actually go into where I just created
    actually go into where I just created

  • 09:39

    that file which is streams slash Python
    that file which is streams slash Python

  • 09:42

    tutorial and I believe that is where I
    tutorial and I believe that is where I

  • 09:45

    created it and you'll see I hit LS for
    created it and you'll see I hit LS for

  • 09:47

    list and then if I type in Python 3 like
    list and then if I type in Python 3 like

  • 09:51

    we did before to open up the interactive
    we did before to open up the interactive

  • 09:52

    show but instead I say hello dot PI
    show but instead I say hello dot PI

  • 09:55

    after that we'll see that it actually
    after that we'll see that it actually

  • 09:57

    outputs exactly what we wrote in the
    outputs exactly what we wrote in the

  • 09:59

    source code you know and while trivial
    source code you know and while trivial

  • 10:00

    go ahead if you could go back to the
    go ahead if you could go back to the

  • 10:01

    terminal window and just literally run
    terminal window and just literally run

  • 10:03

    Pi Python 3 hello dot PI again this
    Pi Python 3 hello dot PI again this

  • 10:05

    should go without saying but because the
    should go without saying but because the

  • 10:07

    code is saved in file you can of course
    code is saved in file you can of course

  • 10:08

    repeat your steps you can improve on the
    repeat your steps you can improve on the

  • 10:10

    program you can fix bugs again and again
    program you can fix bugs again and again

  • 10:12

    can't do that as easily in just the
    can't do that as easily in just the

  • 10:13

    interactive Church really you lose all
    interactive Church really you lose all

  • 10:15

    that state they've created as soon as
    that state they've created as soon as

  • 10:17

    you exit the interpreter in that context
    you exit the interpreter in that context

  • 10:19

    so the place we usually start when
    so the place we usually start when

  • 10:21

    introducing Python to other students is
    introducing Python to other students is

  • 10:23

    to actually now make the program
    to actually now make the program

  • 10:24

    actually interactive like a program that
    actually interactive like a program that

  • 10:26

    just prints out hello world while sort
    just prints out hello world while sort

  • 10:28

    of nice to be part of that history for
    of nice to be part of that history for

  • 10:30

    posterity it's not particularly
    posterity it's not particularly

  • 10:31

    interactive at all beyond just running
    interactive at all beyond just running

  • 10:33

    it so how would in Python you go about
    it so how would in Python you go about

  • 10:36

    asking a user for his or her name
    asking a user for his or her name

  • 10:39

    and say hello so and so instead of just
    and say hello so and so instead of just

  • 10:42

    hello world all the time well it's
    hello world all the time well it's

  • 10:45

    common in a lot of languages that you
    common in a lot of languages that you

  • 10:47

    get some sort of input function Java has
    get some sort of input function Java has

  • 10:49

    one system dot was its you create a
    one system dot was its you create a

  • 10:51

    scanner at system dot in C use a scanf
    scanner at system dot in C use a scanf

  • 10:54

    and in Python it's actually pretty easy
    and in Python it's actually pretty easy

  • 10:58

    all you have to do is just say let's
    all you have to do is just say let's

  • 11:00

    just say I want to store the user's name
    just say I want to store the user's name

  • 11:02

    in a variable called name and then I'll
    in a variable called name and then I'll

  • 11:05

    sign it whatever the return value of
    sign it whatever the return value of

  • 11:07

    this function input is and notice that
    this function input is and notice that

  • 11:11

    I'm still passing in this string hello
    I'm still passing in this string hello

  • 11:12

    world because when I ask them at the
    world because when I ask them at the

  • 11:15

    command line maybe I'd presumably want
    command line maybe I'd presumably want

  • 11:17

    to prompt them for something or maybe
    to prompt them for something or maybe

  • 11:19

    say in this case not hello world but
    say in this case not hello world but

  • 11:21

    please enter your name colon space okay
    please enter your name colon space okay

  • 11:26

    and then if I wrote let's try it out
    and then if I wrote let's try it out

  • 11:28

    let's go ahead and run it so he notice
    let's go ahead and run it so he notice

  • 11:29

    Colton is using some keyboard shortcuts
    Colton is using some keyboard shortcuts

  • 11:31

    he's sitting up on his keyboard which on
    he's sitting up on his keyboard which on

  • 11:32

    a lot of computers will actually rerun
    a lot of computers will actually rerun

  • 11:34

    the previous command and you can keep
    the previous command and you can keep

  • 11:35

    hitting up up up up to go to previous
    hitting up up up up to go to previous

  • 11:37

    commands further so I'm already
    commands further so I'm already

  • 11:40

    realizing there is gonna be a slight
    realizing there is gonna be a slight

  • 11:41

    issue with this so please enter your
    issue with this so please enter your

  • 11:43

    name let's say my name is Colton and the
    name let's say my name is Colton and the

  • 11:45

    program is over nice which is expected
    program is over nice which is expected

  • 11:48

    yeah I mean you only wrote one line of
    yeah I mean you only wrote one line of

  • 11:49

    code that is asking the user for input
    code that is asking the user for input

  • 11:51

    prompting them for their name and then
    prompting them for their name and then

  • 11:53

    storing that value over on the other
    storing that value over on the other

  • 11:55

    hand side the other side in the name
    hand side the other side in the name

  • 11:57

    variable so what do you want to do next
    variable so what do you want to do next

  • 11:58

    well now since I have name actually
    well now since I have name actually

  • 12:01

    stored somewhere I've set name equals or
    stored somewhere I've set name equals or

  • 12:04

    against the value of input please into
    against the value of input please into

  • 12:06

    your name I can actually reuse that
    your name I can actually reuse that

  • 12:08

    variable so I can say print hello space
    variable so I can say print hello space

  • 12:12

    and then there's multiple ways to do
    and then there's multiple ways to do

  • 12:14

    this which you might have time to look
    this which you might have time to look

  • 12:15

    at but all for now I'll just say hello
    at but all for now I'll just say hello

  • 12:17

    and then I'll actually add a name to
    and then I'll actually add a name to

  • 12:19

    that string like that yeah so what's
    that string like that yeah so what's

  • 12:21

    this plus I mean we're not doing
    this plus I mean we're not doing

  • 12:22

    addition here no so this is common in
    addition here no so this is common in

  • 12:24

    light in a lot of languages if this is a
    light in a lot of languages if this is a

  • 12:26

    term called concatenation where you're
    term called concatenation where you're

  • 12:28

    not actually adding numbers you're
    not actually adding numbers you're

  • 12:30

    actually adding strings you're basically
    actually adding strings you're basically

  • 12:32

    taking one string and sticking another
    taking one string and sticking another

  • 12:34

    string right at the end of it now in the
    string right at the end of it now in the

  • 12:36

    common operator for that use case and
    common operator for that use case and

  • 12:38

    there are multiple operators across
    there are multiple operators across

  • 12:41

    different languages but common is the
    different languages but common is the

  • 12:42

    plus just because it's kind of intuitive
    plus just because it's kind of intuitive

  • 12:44

    okay all right well let's let's go ahead
    okay all right well let's let's go ahead

  • 12:46

    and run this it's now two lines of code
    and run this it's now two lines of code

  • 12:47

    Colton has saved his file he's going
    Colton has saved his file he's going

  • 12:49

    back to the interpreter and running it
    back to the interpreter and running it

  • 12:51

    on this file
    on this file

  • 12:52

    and we say hello comes to work now it's
    and we say hello comes to work now it's

  • 12:54

    kind of a it's kind of a cold hello if I
    kind of a it's kind of a cold hello if I

  • 12:56

    wanted I could probably add maybe a
    wanted I could probably add maybe a

  • 12:58

    exclamation point at the end of it just
    exclamation point at the end of it just

  • 13:00

    to make it a little bit more you know I
    to make it a little bit more you know I

  • 13:02

    guess inviting or friendly or an unhappy
    guess inviting or friendly or an unhappy

  • 13:05

    face to see you oh sure I could say I
    face to see you oh sure I could say I

  • 13:07

    could say hello Colton there we go now
    could say hello Colton there we go now

  • 13:13

    unfortunately that's gonna princess my
    unfortunately that's gonna princess my

  • 13:14

    unhappy face for everyone not just
    unhappy face for everyone not just

  • 13:17

    Colton but even me and for you so why
    Colton but even me and for you so why

  • 13:18

    don't we go ahead and change this I feel
    don't we go ahead and change this I feel

  • 13:20

    like in a lot of programming languages
    like in a lot of programming languages

  • 13:21

    that we've seen that folks out there
    that we've seen that folks out there

  • 13:23

    might have seen you can do things like
    might have seen you can do things like

  • 13:24

    conditions you can do something if
    conditions you can do something if

  • 13:26

    something is true else you can do this
    something is true else you can do this

  • 13:28

    other thing so could we modify this
    other thing so could we modify this

  • 13:30

    program in Python to maybe be happy to
    program in Python to maybe be happy to

  • 13:32

    see anyone except you in which case you
    see anyone except you in which case you

  • 13:36

    should see the unhappy face wow this
    should see the unhappy face wow this

  • 13:38

    feels like a depressing Hayward this is
    feels like a depressing Hayward this is

  • 13:41

    this is what the audience is requested
    this is what the audience is requested

  • 13:42

    how is this okay so we'll say okay so
    how is this okay so we'll say okay so

  • 13:45

    well we're gonna get the name and then I
    well we're gonna get the name and then I

  • 13:48

    want to basically check to see what the
    want to basically check to see what the

  • 13:50

    value of the name is Craig because you
    value of the name is Craig because you

  • 13:52

    said we want the frown to only appear
    said we want the frown to only appear

  • 13:54

    whenever it's me and otherwise
    whenever it's me and otherwise

  • 13:57

    exclamation point I'm assume anything
    exclamation point I'm assume anything

  • 13:59

    else really anything
    else really anything

  • 14:00

    okay so we'll say we'll keep it simple
    okay so we'll say we'll keep it simple

  • 14:03

    so I'll say if name is equal to Colton :
    so I'll say if name is equal to Colton :

  • 14:07

    so this is a Python thing if you want to
    so this is a Python thing if you want to

  • 14:09

    do an if statement you Cokely not : yeah
    do an if statement you Cokely not : yeah

  • 14:12

    Colton : then you say we'll say print
    Colton : then you say we'll say print

  • 14:15

    hello and then we'll do plus name plus
    hello and then we'll do plus name plus

  • 14:20

    and I guess in this case we can even
    and I guess in this case we can even

  • 14:22

    hard code the name since it's specific
    hard code the name since it's specific

  • 14:24

    to this use case and then we'll we'll do
    to this use case and then we'll we'll do

  • 14:26

    the frown actually put a space in front
    the frown actually put a space in front

  • 14:27

    of the smiley face because it was
    of the smiley face because it was

  • 14:28

    getting put right on me let's make sure
    getting put right on me let's make sure

  • 14:30

    we see how unhappy we artists yeah
    we see how unhappy we artists yeah

  • 14:32

    exactly and then we'll just do this
    exactly and then we'll just do this

  • 14:34

    other you know thing if that if
    other you know thing if that if

  • 14:37

    statement doesn't turn out to be the
    statement doesn't turn out to be the

  • 14:38

    case if the name is David or anybody
    case if the name is David or anybody

  • 14:40

    else literally in the entire universe
    else literally in the entire universe

  • 14:42

    then we'll just say else would do what
    then we'll just say else would do what

  • 14:45

    we did before which is just print the
    we did before which is just print the

  • 14:46

    name and then in this case though we do
    name and then in this case though we do

  • 14:48

    want we do want the program to be happy
    want we do want the program to be happy

  • 14:50

    to see who it is so we'll do an exercise
    to see who it is so we'll do an exercise

  • 14:51

    so let's run this and then let's come
    so let's run this and then let's come

  • 14:52

    back and we'll tease apart some of the
    back and we'll tease apart some of the

  • 14:54

    syntax that we've just added sure so
    syntax that we've just added sure so

  • 14:55

    we'll say first of all we'll say David
    we'll say first of all we'll say David

  • 14:57

    so hello David so if he was happy to see
    so hello David so if he was happy to see

  • 15:00

    you very nice and polite how about can
    you very nice and polite how about can

  • 15:01

    we do another one can we do how about
    we do another one can we do how about

  • 15:03

    Richard
    Richard

  • 15:04

    Richard Richard okay so please don't
    Richard Richard okay so please don't

  • 15:06

    your name is Richard okay delightful to
    your name is Richard okay delightful to

  • 15:08

    see you as well
    see you as well

  • 15:09

    okay focus II Richard now let's let's
    okay focus II Richard now let's let's

  • 15:11

    test to see if our functionality is
    test to see if our functionality is

  • 15:13

    correct
    correct

  • 15:14

    ar-ar-ar I guess one off use case and
    ar-ar-ar I guess one off use case and

  • 15:17

    we'll use my name Oh perfect this is man
    we'll use my name Oh perfect this is man

  • 15:20

    this is a good program so far we have a
    this is a good program so far we have a

  • 15:22

    smart smart program that knows the
    smart smart program that knows the

  • 15:24

    appropriate way to address sort of
    appropriate way to address sort of

  • 15:25

    though can you run it one more time and
    though can you run it one more time and

  • 15:27

    it's like an angry person can you type
    it's like an angry person can you type

  • 15:28

    your name in all caps this time oh sure
    your name in all caps this time oh sure

  • 15:30

    absolutely so I'll say Colton oh it's
    absolutely so I'll say Colton oh it's

  • 15:34

    happy to see ya no this is a bug this is
    happy to see ya no this is a bug this is

  • 15:37

    objectively a bug so maybe we're gonna
    objectively a bug so maybe we're gonna

  • 15:39

    take a look at a couple of other
    take a look at a couple of other

  • 15:40

    syntactic features but especially if
    syntactic features but especially if

  • 15:41

    you're a little new to programming but
    you're a little new to programming but

  • 15:43

    you have the right intuition here if
    you have the right intuition here if

  • 15:44

    folks in the chat wouldn't mind
    folks in the chat wouldn't mind

  • 15:45

    proposing what techniques we could use
    proposing what techniques we could use

  • 15:48

    to actually solve this problem we'll go
    to actually solve this problem we'll go

  • 15:50

    back in and fix it in just a minute or
    back in and fix it in just a minute or

  • 15:51

    two Congress that's a feature by the way
    two Congress that's a feature by the way

  • 15:53

    that no that's a bug that's a bug but
    that no that's a bug that's a bug but

  • 15:56

    let's go ahead and back to the code for
    let's go ahead and back to the code for

  • 15:57

    just a moment well folks propose some
    just a moment well folks propose some

  • 15:59

    solutions here perhaps and there's a few
    solutions here perhaps and there's a few

  • 16:01

    questions I had for instance if I'm
    questions I had for instance if I'm

  • 16:02

    coming a Python new what's with the
    coming a Python new what's with the

  • 16:05

    colons like I'm used to the indentation
    colons like I'm used to the indentation

  • 16:06

    but the colons when we're the curly
    but the colons when we're the curly

  • 16:08

    braces the so the nice thing about
    braces the so the nice thing about

  • 16:10

    Python is there are no curly braces
    Python is there are no curly braces

  • 16:12

    mm-hmm the the interesting thing about
    mm-hmm the the interesting thing about

  • 16:14

    Python is that everything is based on
    Python is that everything is based on

  • 16:16

    white space so indentation that blocks
    white space so indentation that blocks

  • 16:19

    no I mean this is something that folks
    no I mean this is something that folks

  • 16:21

    may or may not be familiar with but
    may or may not be familiar with but

  • 16:23

    denoting that something essentially is
    denoting that something essentially is

  • 16:25

    inside of something else is done with
    inside of something else is done with

  • 16:27

    indentation so this if statements like
    indentation so this if statements like

  • 16:30

    body of code that executes when it's
    body of code that executes when it's

  • 16:32

    true we don't use curly break braces
    true we don't use curly break braces

  • 16:35

    like we do in other languages we can't
    like we do in other languages we can't

  • 16:36

    in wait we can't inline it but you would
    in wait we can't inline it but you would

  • 16:39

    instead of doing something like this and
    instead of doing something like this and

  • 16:41

    then having and I actually I'm not 100%
    then having and I actually I'm not 100%

  • 16:46

    sure I think this I think technically is
    sure I think this I think technically is

  • 16:49

    it technically possible to you know it's
    it technically possible to you know it's

  • 16:50

    not I'm getting that conflated with I
    not I'm getting that conflated with I

  • 16:52

    think something else but you don't have
    think something else but you don't have

  • 16:54

    another stream entirely but moving on
    another stream entirely but moving on

  • 16:56

    you you don't need these things you you
    you you don't need these things you you

  • 16:59

    can all you just need to do is make sure
    can all you just need to do is make sure

  • 17:00

    this is indented a certain level within
    this is indented a certain level within

  • 17:03

    this after this if statement here and
    this after this if statement here and

  • 17:05

    now without opening a can of worms
    now without opening a can of worms

  • 17:06

    what's your preference you like tabs you
    what's your preference you like tabs you

  • 17:08

    like spaces I like
    like spaces I like

  • 17:10

    tabs that get converted into spaces okay
    tabs that get converted into spaces okay

  • 17:12

    I'll take that as an acceptable answer
    I'll take that as an acceptable answer

  • 17:14

    indeed in the Python community unlike
    indeed in the Python community unlike

  • 17:15

    most languages there is an accepted norm
    most languages there is an accepted norm

  • 17:18

    or at least a recommended norm which is
    or at least a recommended norm which is

  • 17:19

    to use spaces so let's put an end to
    to use spaces so let's put an end to

  • 17:21

    that debate today we're gonna use spaces
    that debate today we're gonna use spaces

  • 17:23

    for spaces generally would be pretty
    for spaces generally would be pretty

  • 17:25

    common but I like that you don't have to
    common but I like that you don't have to

  • 17:26

    do the the curly braces as you know but
    do the the curly braces as you know but

  • 17:29

    I notice you're also using single quotes
    I notice you're also using single quotes

  • 17:31

    and I feel like in different languages
    and I feel like in different languages

  • 17:32

    and even in Python I sometimes see
    and even in Python I sometimes see

  • 17:34

    single quotes sometimes double quotes
    single quotes sometimes double quotes

  • 17:35

    how do I think about that so there are
    how do I think about that so there are

  • 17:37

    for the for the large part
    for the for the large part

  • 17:39

    interchangeable you can make strings
    interchangeable you can make strings

  • 17:41

    with double quotes you can make strings
    with double quotes you can make strings

  • 17:43

    with single quotes now if you're coming
    with single quotes now if you're coming

  • 17:44

    from a background like C or Java you can
    from a background like C or Java you can

  • 17:47

    only use double quotes for strings but
    only use double quotes for strings but

  • 17:49

    you have to use single quotes for single
    you have to use single quotes for single

  • 17:50

    characters okay Python there's no
    characters okay Python there's no

  • 17:52

    difference there are no there is not
    difference there are no there is not

  • 17:53

    really a by default single character
    really a by default single character

  • 17:56

    versus string when you're using you know
    versus string when you're using you know

  • 17:59

    this apostrophe character or the double
    this apostrophe character or the double

  • 18:00

    quote character so how would people go
    quote character so how would people go

  • 18:02

    about deciding whether on a single quote
    about deciding whether on a single quote

  • 18:03

    kind of person or a double quote kind of
    kind of person or a double quote kind of

  • 18:05

    person well I think that's a matter of
    person well I think that's a matter of

  • 18:07

    taste but if you are use if your string
    taste but if you are use if your string

  • 18:09

    for example contains let's say colton's
    for example contains let's say colton's

  • 18:13

    favorite food pizza we can see that
    favorite food pizza we can see that

  • 18:17

    there's an issue in that different in
    there's an issue in that different in

  • 18:19

    that we see the green that we've seen
    that we see the green that we've seen

  • 18:22

    before with strings after this
    before with strings after this

  • 18:24

    apostrophe up until this apostrophe
    apostrophe up until this apostrophe

  • 18:27

    where we're actually using it for
    where we're actually using it for

  • 18:28

    grammar we're actually using it as a
    grammar we're actually using it as a

  • 18:30

    part of the string itself and there's a
    part of the string itself and there's a

  • 18:32

    couple ways of dealing with this one way
    couple ways of dealing with this one way

  • 18:34

    is we can use the backslash like this
    is we can use the backslash like this

  • 18:37

    and that'll fix it so now we've actually
    and that'll fix it so now we've actually

  • 18:39

    said ignore this apostrophe this is part
    said ignore this apostrophe this is part

  • 18:42

    of the actual string yep Jeanette
    of the actual string yep Jeanette

  • 18:43

    Jeanette sax notes that as well nice but
    Jeanette sax notes that as well nice but

  • 18:45

    let's say I don't like the way that
    let's say I don't like the way that

  • 18:47

    looks I don't like having a backslash to
    looks I don't like having a backslash to

  • 18:49

    start my strings all over the place
    start my strings all over the place

  • 18:50

    instead I can decide in any case where I
    instead I can decide in any case where I

  • 18:53

    do have a single quote inside the string
    do have a single quote inside the string

  • 18:55

    itself I'll use double quotes on the
    itself I'll use double quotes on the

  • 18:57

    outside and because this doesn't match
    outside and because this doesn't match

  • 19:00

    up with this it doesn't cause an error
    up with this it doesn't cause an error

  • 19:02

    in parsing the string nice yeah an
    in parsing the string nice yeah an

  • 19:04

    augment I'm kind of going through an
    augment I'm kind of going through an

  • 19:05

    existential crisis I've been using
    existential crisis I've been using

  • 19:07

    double quotes for like 20 years and
    double quotes for like 20 years and

  • 19:09

    frankly I'm tired of holding the shift
    frankly I'm tired of holding the shift

  • 19:10

    key down and I do think you're seeing in
    key down and I do think you're seeing in

  • 19:13

    more modern Lee popular languages Python
    more modern Lee popular languages Python

  • 19:15

    and JavaScript among them I'm starting
    and JavaScript among them I'm starting

  • 19:17

    to see frankly I think single quotes
    to see frankly I think single quotes

  • 19:19

    more often but you got to beware because
    more often but you got to beware because

  • 19:20

    of the stupid grammar issues alike so
    of the stupid grammar issues alike so

  • 19:23

    just be consistent I think is the point
    just be consistent I think is the point

  • 19:24

    or resort to one or the other when you
    or resort to one or the other when you

  • 19:27

    have two contextual e-commerce a big fan
    have two contextual e-commerce a big fan

  • 19:29

    of single quotes itself as well don't
    of single quotes itself as well don't

  • 19:30

    like whole event sure yeah yeah I know
    like whole event sure yeah yeah I know

  • 19:33

    too much shift at 20 years of hitting
    too much shift at 20 years of hitting

  • 19:35

    the shift key is enough somebody
    the shift key is enough somebody

  • 19:36

    proposed an interesting way of getting
    proposed an interesting way of getting

  • 19:38

    around the the problem yeah let's come
    around the the problem yeah let's come

  • 19:41

    back to that I heard someone propose
    back to that I heard someone propose

  • 19:42

    that we use lower so force the whole
    that we use lower so force the whole

  • 19:44

    string to lowercase I see Richard
    string to lowercase I see Richard

  • 19:46

    proposed using an array or a list in
    proposed using an array or a list in

  • 19:48

    Python where we could check for little
    Python where we could check for little

  • 19:50

    Colton or big Colton or alternating caps
    Colton or big Colton or alternating caps

  • 19:52

    Colton I think the downside there is
    Colton I think the downside there is

  • 19:54

    that you're gonna have an annoying
    that you're gonna have an annoying

  • 19:55

    number of permutations of Colton's if
    number of permutations of Colton's if

  • 19:57

    you will with the C is capitalized or
    you will with the C is capitalized or

  • 19:59

    the O or the L or multiple ones and so
    the O or the L or multiple ones and so

  • 20:02

    forth so I like this lower ID and this
    forth so I like this lower ID and this

  • 20:04

    is actually pretty conventional in a lot
    is actually pretty conventional in a lot

  • 20:05

    of programming languages especially
    of programming languages especially

  • 20:06

    Python when you want to compare
    Python when you want to compare

  • 20:09

    something for equality you canonicalize
    something for equality you canonicalize

  • 20:11

    it so to speak you force it to all
    it so to speak you force it to all

  • 20:13

    lowercase or all lower all lowercase are
    lowercase or all lower all lowercase are

  • 20:15

    all uppercase so that you know
    all uppercase so that you know

  • 20:17

    definitively what you're comparing
    definitively what you're comparing

  • 20:18

    against but you don't want to do it
    against but you don't want to do it

  • 20:19

    destructively you want to do it
    destructively you want to do it

  • 20:20

    essentially temporarily on a copy of the
    essentially temporarily on a copy of the

  • 20:23

    variable right exactly so how could we
    variable right exactly so how could we

  • 20:24

    do that here to make sure that we are
    do that here to make sure that we are

  • 20:25

    unhappy to see you well we could say
    unhappy to see you well we could say

  • 20:28

    essentially here's here's what happens I
    essentially here's here's what happens I

  • 20:31

    guess we should demonstrate this in the
    guess we should demonstrate this in the

  • 20:32

    terminal before week before we do
    terminal before week before we do

  • 20:33

    anything else so I'm gonna pull up
    anything else so I'm gonna pull up

  • 20:34

    Python 3 and this is a nice thing
    Python 3 and this is a nice thing

  • 20:36

    actually at first what I'm gonna do it's
    actually at first what I'm gonna do it's

  • 20:37

    gonna clear my CLI and then I'm gonna
    gonna clear my CLI and then I'm gonna

  • 20:39

    pull up Python 3 if you're ever curious
    pull up Python 3 if you're ever curious

  • 20:41

    about using a function in Python this is
    about using a function in Python this is

  • 20:43

    the downs this is the upside and being
    the downs this is the upside and being

  • 20:45

    able to use it in an interpreter context
    able to use it in an interpreter context

  • 20:46

    you can actually just fire up your
    you can actually just fire up your

  • 20:47

    interpreter and just test variables test
    interpreter and just test variables test

  • 20:50

    functions right away and I happen to
    functions right away and I happen to

  • 20:52

    know that there's a function called dot
    know that there's a function called dot

  • 20:54

    lower it works on strings but let's
    lower it works on strings but let's

  • 20:56

    actually experiment with it so if I say
    actually experiment with it so if I say

  • 20:58

    let's let's do for example the string
    let's let's do for example the string

  • 21:00

    Colton and we'll say the lower
    Colton and we'll say the lower

  • 21:03

    parentheses and we'll hit enter and
    parentheses and we'll hit enter and

  • 21:06

    we'll see that indeed brings it all down
    we'll see that indeed brings it all down

  • 21:08

    now this is weird why do you have a
    now this is weird why do you have a

  • 21:09

    period after a string don't you need to
    period after a string don't you need to

  • 21:11

    do with that on like a variable or
    do with that on like a variable or

  • 21:13

    something so this is then this gets into
    something so this is then this gets into

  • 21:15

    kind of the idea of what's called
    kind of the idea of what's called

  • 21:16

    object-oriented programming which we
    object-oriented programming which we

  • 21:18

    won't dive into today but essentially
    won't dive into today but essentially

  • 21:20

    every string in Python has a series of
    every string in Python has a series of

  • 21:23

    functions that it has its own reference
    functions that it has its own reference

  • 21:25

    to and the function when you when you
    to and the function when you when you

  • 21:28

    call it using this dot which essentially
    call it using this dot which essentially

  • 21:29

    means go inside of the thing to the left
    means go inside of the thing to the left

  • 21:31

    and then exit
    and then exit

  • 21:33

    this thing that belongs to that thing on
    this thing that belongs to that thing on

  • 21:36

    the left in this case the lower function
    the left in this case the lower function

  • 21:37

    sort of belongs to this string Colton it
    sort of belongs to this string Colton it

  • 21:40

    will run this function and sort of
    will run this function and sort of

  • 21:42

    implicitly pass in this as a parameter
    implicitly pass in this as a parameter

  • 21:45

    to this function yeah so what you really
    to this function yeah so what you really

  • 21:47

    have is that Colton is indeed a string
    have is that Colton is indeed a string

  • 21:49

    in this case in a string is an actual
    in this case in a string is an actual

  • 21:51

    object I can create a class in Python so
    object I can create a class in Python so

  • 21:53

    it has all of these phone bill tin to it
    it has all of these phone bill tin to it

  • 21:56

    just one of which is this this lower
    just one of which is this this lower

  • 21:57

    function so I see hasanul e proposed I
    function so I see hasanul e proposed I

  • 22:00

    think what's actually a perfect solution
    think what's actually a perfect solution

  • 22:02

    and that's a little simpler and less
    and that's a little simpler and less

  • 22:04

    code to write than something like a list
    code to write than something like a list

  • 22:05

    based approach so we want to deploy
    based approach so we want to deploy

  • 22:07

    Hasan's approach sure so first before we
    Hasan's approach sure so first before we

  • 22:09

    do that let's just test it again so we
    do that let's just test it again so we

  • 22:11

    have the the version where it's my name
    have the the version where it's my name

  • 22:13

    type normally let's type let's test it
    type normally let's type let's test it

  • 22:15

    with the version of my name and all
    with the version of my name and all

  • 22:16

    uppercase which does also go to the name
    uppercase which does also go to the name

  • 22:20

    Colton and then just for just for kicks
    Colton and then just for just for kicks

  • 22:21

    will do will do all my space style text
    will do will do all my space style text

  • 22:25

    and then we'll show an area there we go
    and then we'll show an area there we go

  • 22:27

    okay and then we'll see that no matter
    okay and then we'll see that no matter

  • 22:28

    what permutation of capitalization we
    what permutation of capitalization we

  • 22:31

    use we are unhappy to see you yes
    use we are unhappy to see you yes

  • 22:33

    exactly
    exactly

  • 22:33

    come with a better town to the same base
    come with a better town to the same base

  • 22:36

    case so I'm gonna exit Python and then
    case so I'm gonna exit Python and then

  • 22:38

    we'll adopt what was it Sean said which
    we'll adopt what was it Sean said which

  • 22:41

    was if name
    was if name

  • 22:43

    lower is equal to not not to Colton with
    lower is equal to not not to Colton with

  • 22:47

    a capital C because that would that
    a capital C because that would that

  • 22:49

    won't work there will never be any
    won't work there will never be any

  • 22:50

    capital letters you're right alone I
    capital letters you're right alone I

  • 22:52

    think well andrey caught it there but
    think well andrey caught it there but

  • 22:54

    and I overstated we do have to make one
    and I overstated we do have to make one

  • 22:56

    tweak which is just replace that with a
    tweak which is just replace that with a

  • 22:59

    lowercase C indeed and if you run this
    lowercase C indeed and if you run this

  • 23:01

    let's go back here and we'll do Python 3
    let's go back here and we'll do Python 3

  • 23:04

    of hello dot pi again which I could have
    of hello dot pi again which I could have

  • 23:06

    just hit up probably and we'll first
    just hit up probably and we'll first

  • 23:08

    we'll try it with my name like this okay
    we'll try it with my name like this okay

  • 23:11

    hello Colton it's a it's a frown okay so
    hello Colton it's a it's a frown okay so

  • 23:13

    that was the behavior that was happening
    that was the behavior that was happening

  • 23:15

    before let's try it again but this time
    before let's try it again but this time

  • 23:17

    let's let's do just the first few couple
    let's let's do just the first few couple

  • 23:19

    letters capitalized oh oh but here's the
    letters capitalized oh oh but here's the

  • 23:21

    interesting thing is actually okay
    interesting thing is actually okay

  • 23:23

    nevermind it's still printing out Co a
    nevermind it's still printing out Co a

  • 23:26

    nice feature would be to have it print
    nice feature would be to have it print

  • 23:28

    out the name with just a capital letter
    out the name with just a capital letter

  • 23:29

    and not you should say cuz our next
    and not you should say cuz our next

  • 23:32

    challenge is gonna be exactly that so
    challenge is gonna be exactly that so

  • 23:34

    your user does miss type his or her name
    your user does miss type his or her name

  • 23:36

    in some stupid way like Colton video
    in some stupid way like Colton video

  • 23:38

    capital C capital o l3o in classic
    capital C capital o l3o in classic

  • 23:41

    Colton we can at least with some
    Colton we can at least with some

  • 23:43

    probability fix this in code now I say
    probability fix this in code now I say

  • 23:46

    some probability because at least in
    some probability because at least in

  • 23:47

    English there's a lot of names that have
    English there's a lot of names that have

  • 23:49

    a mix of uppercase and lowercase
    a mix of uppercase and lowercase

  • 23:50

    characters O'Reilly for instance is a
    characters O'Reilly for instance is a

  • 23:52

    last name also the the name on a very
    last name also the the name on a very

  • 23:54

    popular series of computer science books
    popular series of computer science books

  • 23:56

    you might know so we could get this
    you might know so we could get this

  • 23:58

    wrong but let's assume that we have very
    wrong but let's assume that we have very

  • 24:00

    simple names in this case like Colton
    simple names in this case like Colton

  • 24:02

    Capital Co how in Python could you force
    Capital Co how in Python could you force

  • 24:05

    the users input to be neatened not all
    the users input to be neatened not all

  • 24:07

    lowercase but capital C and then
    lowercase but capital C and then

  • 24:09

    lowercase Olten well my first instinct
    lowercase Olten well my first instinct

  • 24:11

    would be probably to use this named
    would be probably to use this named

  • 24:14

    lower as our starting point well we'll
    lower as our starting point well we'll

  • 24:17

    bring everything we'll canonicalize all
    bring everything we'll canonicalize all

  • 24:19

    the names back to all lowercase like
    the names back to all lowercase like

  • 24:20

    this and this actually let's actually
    this and this actually let's actually

  • 24:22

    start with that so we'll go name dot
    start with that so we'll go name dot

  • 24:24

    lower actually other way around well
    lower actually other way around well

  • 24:27

    actually no will do in both cases we'll
    actually no will do in both cases we'll

  • 24:28

    do in both cases so now you'll notice
    do in both cases so now you'll notice

  • 24:30

    that I'm printing named lower in the
    that I'm printing named lower in the

  • 24:32

    actual output for both situations and
    actual output for both situations and

  • 24:35

    what we've typed into name so that way
    what we've typed into name so that way

  • 24:37

    even if we type in capital C capital o
    even if we type in capital C capital o

  • 24:39

    LTO n it's still gonna give us the
    LTO n it's still gonna give us the

  • 24:41

    canonicalized
    canonicalized

  • 24:42

    strings and not the best design but
    strings and not the best design but

  • 24:44

    we'll get there well let's try this out
    we'll get there well let's try this out

  • 24:46

    so we'll say this plays into your name
    so we'll say this plays into your name

  • 24:48

    and we'll try Colton like that and it
    and we'll try Colton like that and it

  • 24:51

    doesn't need say hello Colton with
    doesn't need say hello Colton with

  • 24:53

    everything lowercase we're halfway there
    everything lowercase we're halfway there

  • 24:55

    yeah I'm still have to now do the very
    yeah I'm still have to now do the very

  • 24:56

    first string okay and the first
    first string okay and the first

  • 24:58

    character and the first character in the
    character and the first character in the

  • 25:00

    string so I actually offhand don't know
    string so I actually offhand don't know

  • 25:02

    what function strings might have to
    what function strings might have to

  • 25:04

    capitalize the first letter but the chat
    capitalize the first letter but the chat

  • 25:07

    though so the chat happens but don't
    though so the chat happens but don't

  • 25:09

    know looking at looking at how would you
    know looking at looking at how would you

  • 25:11

    do this if you were home alone with that
    do this if you were home alone with that

  • 25:12

    a live twitch stream to answer your
    a live twitch stream to answer your

  • 25:14

    these questions for sure so I would
    these questions for sure so I would

  • 25:15

    probably say Python capitalized first
    probably say Python capitalized first

  • 25:19

    letter string so have the name of the
    letter string so have the name of the

  • 25:21

    language is the first word cuz it's
    language is the first word cuz it's

  • 25:23

    probably gonna be a major thing that
    probably gonna be a major thing that

  • 25:25

    Google optimizes for and then just
    Google optimizes for and then just

  • 25:28

    literally kind of the main words that I
    literally kind of the main words that I

  • 25:30

    care about in the query for what I'm
    care about in the query for what I'm

  • 25:31

    looking at which capitalized not you
    looking at which capitalized not you

  • 25:33

    know we explore the first letter in a
    know we explore the first letter in a

  • 25:36

    string yeah and this is something you
    string yeah and this is something you

  • 25:38

    learn over time and odds are most
    learn over time and odds are most

  • 25:39

    everyone in the chatroom is learning
    everyone in the chatroom is learning

  • 25:40

    this already you don't have to ask
    this already you don't have to ask

  • 25:42

    Google or Bing or whatever you use full
    Google or Bing or whatever you use full

  • 25:43

    sentences you can drop the words that
    sentences you can drop the words that

  • 25:45

    really aren't adding anything to the
    really aren't adding anything to the

  • 25:46

    query like how and
    query like how and

  • 25:48

    and it and is and really just focus on
    and it and is and really just focus on

  • 25:50

    the words like Colton has here that
    the words like Colton has here that

  • 25:52

    really have more information content for
    really have more information content for

  • 25:54

    the research engine exactly somebody I'm
    the research engine exactly somebody I'm

  • 25:55

    gonna do that query and the Google is
    gonna do that query and the Google is

  • 25:58

    amazing the first result says in Python
    amazing the first result says in Python

  • 26:00

    the capitalized method converts the
    the capitalized method converts the

  • 26:02

    first character of a string to capital
    first character of a string to capital

  • 26:04

    letter uppercase letter if the string
    letter uppercase letter if the string

  • 26:06

    has its first character as a capital it
    has its first character as a capital it

  • 26:08

    returns the original string yeah and I
    returns the original string yeah and I

  • 26:10

    don't use this particular site too often
    don't use this particular site too often

  • 26:12

    myself geeks for geeks or but it seems
    myself geeks for geeks or but it seems

  • 26:14

    on point and just for kicks can you
    on point and just for kicks can you

  • 26:15

    scroll down just so we can see what some
    scroll down just so we can see what some

  • 26:16

    of the other search results are sure so
    of the other search results are sure so

  • 26:18

    we're seeing stuck overflow is number
    we're seeing stuck overflow is number

  • 26:20

    two stuck overflow is number three a
    two stuck overflow is number three a

  • 26:21

    blog is number four programming program
    blog is number four programming program

  • 26:25

    is calm is the next so you'll start to
    is calm is the next so you'll start to

  • 26:28

    see patterns in search results if you're
    see patterns in search results if you're

  • 26:29

    learning programming or teaching
    learning programming or teaching

  • 26:30

    yourself Stack Overflow is a big one but
    yourself Stack Overflow is a big one but

  • 26:32

    sometimes Google thinks that it's pretty
    sometimes Google thinks that it's pretty

  • 26:34

    sure what it knows what the answer is so
    sure what it knows what the answer is so

  • 26:36

    it'll just bubble it up special to the
    it'll just bubble it up special to the

  • 26:38

    top oh all right so let's try this but
    top oh all right so let's try this but

  • 26:39

    shout out to those of you in the chat
    shout out to those of you in the chat

  • 26:41

    juban three and davis 216 all of whom
    juban three and davis 216 all of whom

  • 26:45

    got this and major if thats if i'm
    got this and major if thats if i'm

  • 26:47

    pronouncing that right also at a clever
    pronouncing that right also at a clever

  • 26:48

    solution but arguably you're reinventing
    solution but arguably you're reinventing

  • 26:50

    a wheel and i would propose that in
    a wheel and i would propose that in

  • 26:53

    python you really try to reuse some of
    python you really try to reuse some of

  • 26:55

    the wheels that have been given but odds
    the wheels that have been given but odds

  • 26:56

    are underneath the hood capitalized is
    are underneath the hood capitalized is

  • 26:58

    doing something quite like that but
    doing something quite like that but

  • 27:00

    probably with some error checking just
    probably with some error checking just

  • 27:01

    in case name is short indeed
    in case name is short indeed

  • 27:03

    so we'll say name dot lower now this is
    so we'll say name dot lower now this is

  • 27:06

    an interesting thing so when we call
    an interesting thing so when we call

  • 27:08

    this method dot lower it's actually
    this method dot lower it's actually

  • 27:10

    returning a string and new stream and
    returning a string and new stream and

  • 27:13

    then that's essentially what we're doing
    then that's essentially what we're doing

  • 27:14

    here we're returning a new string and
    here we're returning a new string and

  • 27:16

    putting into the output we're returning
    putting into the output we're returning

  • 27:17

    a new string and comparing it to the
    a new string and comparing it to the

  • 27:19

    string colton so the cool thing is that
    string colton so the cool thing is that

  • 27:22

    you can actually chain these methods
    you can actually chain these methods

  • 27:24

    onto themselves so I can say name dot
    onto themselves so I can say name dot

  • 27:26

    lower which gives me the name Colton in
    lower which gives me the name Colton in

  • 27:28

    all lower case or whatever name and all
    all lower case or whatever name and all

  • 27:30

    lower case letters but I can then do dot
    lower case letters but I can then do dot

  • 27:34

    capitalize like so and what this will do
    capitalize like so and what this will do

  • 27:38

    is this will say okay give me the thing
    is this will say okay give me the thing

  • 27:40

    give me the dot lower method of the
    give me the dot lower method of the

  • 27:41

    thing to the left okay and return it so
    thing to the left okay and return it so

  • 27:43

    this will give whatever the name is all
    this will give whatever the name is all

  • 27:45

    lower case letters and then this becomes
    lower case letters and then this becomes

  • 27:48

    essentially that then when you call dot
    essentially that then when you call dot

  • 27:49

    capital wise it's doing the same thing
    capital wise it's doing the same thing

  • 27:52

    and saying give me the value to the left
    and saying give me the value to the left

  • 27:53

    and then capitalize its first letter
    and then capitalize its first letter

  • 27:55

    that thing to the left is now that lower
    that thing to the left is now that lower

  • 27:57

    case
    case

  • 27:58

    straight now when you hover over
    straight now when you hover over

  • 27:59

    capitalise based on the definition of
    capitalise based on the definition of

  • 28:01

    this function the BS code is feeding us
    this function the BS code is feeding us

  • 28:03

    here do we need to force things to
    here do we need to force things to

  • 28:05

    lowercase first and how would you go
    lowercase first and how would you go

  • 28:07

    about figuring that out I returned a
    about figuring that out I returned a

  • 28:10

    capitalized version of the string more
    capitalized version of the string more

  • 28:11

    specifically make the first character
    specifically make the first character

  • 28:13

    have uppercase and the rest lowercase ah
    have uppercase and the rest lowercase ah

  • 28:15

    that's interesting I actually didn't
    that's interesting I actually didn't

  • 28:17

    realize that that was part of the
    realize that that was part of the

  • 28:18

    signature well let's try it then in that
    signature well let's try it then in that

  • 28:19

    case so let's say if name dot capitalize
    case so let's say if name dot capitalize

  • 28:23

    name capitalized and in this case I mean
    name capitalized and in this case I mean

  • 28:28

    we could even we could even do it here
    we could even we could even do it here

  • 28:29

    and just and say Colton and then dot
    and just and say Colton and then dot

  • 28:31

    capitalized let's try it out so let's
    capitalized let's try it out so let's

  • 28:37

    say the name of Colton first okay hello
    say the name of Colton first okay hello

  • 28:40

    Colton let's try see Oh LTO n whoops
    Colton let's try see Oh LTO n whoops

  • 28:44

    nice man look we have a whole new
    nice man look we have a whole new

  • 28:46

    problem and how do we fix that problem
    problem and how do we fix that problem

  • 28:47

    we get better at using the terminal oh
    we get better at using the terminal oh

  • 28:49

    it turns out that that actually worked a
    it turns out that that actually worked a

  • 28:53

    few steps ahead of us right and so
    few steps ahead of us right and so

  • 28:55

    besides trial and error like we just did
    besides trial and error like we just did

  • 28:56

    too you can certainly read the official
    too you can certainly read the official

  • 28:57

    documentation in fact just so folks can
    documentation in fact just so folks can

  • 28:59

    see it if you've never seen pythons
    see it if you've never seen pythons

  • 29:01

    documentation it's so-so
    documentation it's so-so

  • 29:03

    like all the and well most of the
    like all the and well most of the

  • 29:04

    information is there but it's not always
    information is there but it's not always

  • 29:06

    that easy to find what you're looking
    that easy to find what you're looking

  • 29:07

    for dave is not a huge fan of the Python
    for dave is not a huge fan of the Python

  • 29:09

    document so it could be much more
    document so it could be much more

  • 29:10

    user-friendly so can you go ahead and
    user-friendly so can you go ahead and

  • 29:12

    find us the documentation for the
    find us the documentation for the

  • 29:14

    stiring classes capitalized function
    stiring classes capitalized function

  • 29:17

    yeah so we'll go to STR which is the
    yeah so we'll go to STR which is the

  • 29:20

    string class in Python a string object
    string class in Python a string object

  • 29:23

    type and we went right here string
    type and we went right here string

  • 29:25

    capitalized and it looks like it's
    capitalized and it looks like it's

  • 29:27

    almost the important verbatim so yes
    almost the important verbatim so yes

  • 29:29

    codes probably getting its instructions
    codes probably getting its instructions

  • 29:31

    right from here but this is good that we
    right from here but this is good that we

  • 29:33

    have the documentation up and notice how
    have the documentation up and notice how

  • 29:34

    it's ordered you have on the Left
    it's ordered you have on the Left

  • 29:36

    indented all of left aligned you have
    indented all of left aligned you have

  • 29:39

    all of the function names in that class
    all of the function names in that class

  • 29:40

    boldface no less capitalized case fold
    boldface no less capitalized case fold

  • 29:43

    Center someone in the chat just a moment
    Center someone in the chat just a moment

  • 29:44

    ago proposed title the title function is
    ago proposed title the title function is

  • 29:48

    there a title function inside the string
    there a title function inside the string

  • 29:49

    class let's go ahead and look if there's
    class let's go ahead and look if there's

  • 29:51

    is title its string title yeah so this
    is title its string title yeah so this

  • 29:55

    is title case version of the string or
    is title case version of the string or

  • 29:57

    word start with an uppercase character
    word start with an uppercase character

  • 29:59

    and the remaining characters are
    and the remaining characters are

  • 30:01

    lowercase so this would be great for
    lowercase so this would be great for

  • 30:02

    four full names yeah assuming no
    four full names yeah assuming no

  • 30:04

    weirdness with like lowercase letters
    weirdness with like lowercase letters

  • 30:06

    needing to be lowercase still sure but
    needing to be lowercase still sure but

  • 30:08

    yeah absolutely
    yeah absolutely

  • 30:09

    so we can maybe even experiment with
    so we can maybe even experiment with

  • 30:10

    that so if I were to say let's go back
    that so if I were to say let's go back

  • 30:12

    to the s code let's say it most
    to the s code let's say it most

  • 30:13

    specifically maybe there's a Colton
    specifically maybe there's a Colton

  • 30:15

    Jackson that we that we'd like to see
    Jackson that we that we'd like to see

  • 30:18

    but Colton Ogden is the one we don't
    but Colton Ogden is the one we don't

  • 30:19

    want to see so why don't we go ahead and
    want to see so why don't we go ahead and

  • 30:21

    test that out so we'll say name title is
    test that out so we'll say name title is

  • 30:24

    equal to because remember title doesn't
    equal to because remember title doesn't

  • 30:25

    capitalized us but to multiple words in
    capitalized us but to multiple words in

  • 30:27

    the string so in this case we don't have
    the string so in this case we don't have

  • 30:29

    just one word we actually have two words
    just one word we actually have two words

  • 30:31

    separated by its space so let's go ahead
    separated by its space so let's go ahead

  • 30:33

    and say named title and name title and
    and say named title and name title and

  • 30:37

    there is a better way to do this which
    there is a better way to do this which

  • 30:39

    we should probably also take a look at
    we should probably also take a look at

  • 30:41

    in just a second as well
    in just a second as well

  • 30:42

    so we'll go ahead and run this code and
    so we'll go ahead and run this code and

  • 30:45

    I'm gonna enter my name as Colton Ogden
    I'm gonna enter my name as Colton Ogden

  • 30:48

    but all lowercase letters still don't
    but all lowercase letters still don't

  • 30:50

    like them oh it looks like you figured
    like them oh it looks like you figured

  • 30:53

    it out nice and actually smart
    it out nice and actually smart

  • 30:54

    programming this is this artificial
    programming this is this artificial

  • 30:56

    intelligence and this is the very this
    intelligence and this is the very this

  • 30:58

    is the seed for artificial intelligence
    is the seed for artificial intelligence

  • 30:59

    your six-line state-of-the-art you know
    your six-line state-of-the-art you know

  • 31:02

    I would propose here too we are using on
    I would propose here too we are using on

  • 31:04

    line three title to compare against
    line three title to compare against

  • 31:06

    Colton Ogden capital C capital o yep I
    Colton Ogden capital C capital o yep I

  • 31:09

    admit I don't love that maybe you can
    admit I don't love that maybe you can

  • 31:11

    convince me otherwise it just feels
    convince me otherwise it just feels

  • 31:12

    weird to not just choose something super
    weird to not just choose something super

  • 31:14

    simple like all lowercase or all
    simple like all lowercase or all

  • 31:16

    uppercase right because this assumes
    uppercase right because this assumes

  • 31:18

    that now I have the sophistication or my
    that now I have the sophistication or my

  • 31:20

    colleagues know what title does and
    colleagues know what title does and

  • 31:22

    therefore this just seems a little more
    therefore this just seems a little more

  • 31:24

    fragile would you agree or disagree I
    fragile would you agree or disagree I

  • 31:26

    think I would large they agree I think I
    think I would large they agree I think I

  • 31:28

    would say I think I would say what I
    would say I think I would say what I

  • 31:30

    don't like the most is that we're using
    don't like the most is that we're using

  • 31:31

    name title dot the dot title method
    name title dot the dot title method

  • 31:33

    specifically in three places that for
    specifically in three places that for

  • 31:36

    sure but I don't like title for
    sure but I don't like title for

  • 31:37

    formatting but for for quality testing
    formatting but for for quality testing

  • 31:40

    personally I would suggest you use
    personally I would suggest you use

  • 31:42

    something that's absolutely robust all
    something that's absolutely robust all

  • 31:43

    lowercase all uppercase or another
    lowercase all uppercase or another

  • 31:45

    technique altogether but we'll get there
    technique altogether but we'll get there

  • 31:47

    in just a moment again and another
    in just a moment again and another

  • 31:49

    something good up my sleeve for you yeah
    something good up my sleeve for you yeah

  • 31:50

    well dot lower lower probably be better
    well dot lower lower probably be better

  • 31:52

    sorry so change that's what lower which
    sorry so change that's what lower which

  • 31:53

    this - dot lower and then here's a nice
    this - dot lower and then here's a nice

  • 31:55

    little shortcut if using vs code and
    little shortcut if using vs code and

  • 31:56

    your highlight something let's say I
    your highlight something let's say I

  • 31:58

    want to edit this and this whoops this
    want to edit this and this whoops this

  • 32:00

    at the same time so I actually highlight
    at the same time so I actually highlight

  • 32:01

    this and if I hit command D or control D
    this and if I hit command D or control D

  • 32:04

    on a Windows computer I actually have
    on a Windows computer I actually have

  • 32:06

    multiple cursors
    multiple cursors

  • 32:07

    so now I can actually go over here and
    so now I can actually go over here and

  • 32:08

    type lower amazing in two different
    type lower amazing in two different

  • 32:10

    places it's typing twice as fast as I
    places it's typing twice as fast as I

  • 32:12

    could have in my day there we go so
    could have in my day there we go so

  • 32:14

    let's let's take things up a notch
    let's let's take things up a notch

  • 32:16

    if we can because you know you have a
    if we can because you know you have a

  • 32:19

    middle name right
    middle name right

  • 32:20

    a lot of people have middle names and we
    a lot of people have middle names and we

  • 32:22

    want to make sure that we want to be
    want to make sure that we want to be

  • 32:24

    unhappy about all Colton Ogden's not
    unhappy about all Colton Ogden's not

  • 32:27

    just you specifically so how could we go
    just you specifically so how could we go

  • 32:29

    about adapting this program in such a
    about adapting this program in such a

  • 32:31

    way then it is unhappy to see Colton
    way then it is unhappy to see Colton

  • 32:34

    something Ogden or Colton something else
    something Ogden or Colton something else

  • 32:38

    Ogden so that there's a Colton at the
    Ogden so that there's a Colton at the

  • 32:40

    beginning and OGG and at the end we
    beginning and OGG and at the end we

  • 32:41

    don't care what's in the middle but
    don't care what's in the middle but

  • 32:43

    there can be something in the middle how
    there can be something in the middle how

  • 32:45

    would you go about solving that problem
    would you go about solving that problem

  • 32:46

    a middle name middle name yeah but one
    a middle name middle name yeah but one

  • 32:48

    name two names
    name two names

  • 32:50

    arbitrary number middle name I just
    arbitrary number middle name I just

  • 32:51

    don't want to see any Colton's over here
    don't want to see any Colton's over here

  • 32:53

    or Coggins over here okay sure so in
    or Coggins over here okay sure so in

  • 32:57

    this case what we can probably do is
    this case what we can probably do is

  • 32:59

    figure out well first of all we're gonna
    figure out well first of all we're gonna

  • 33:01

    get input in a string of some kind and
    get input in a string of some kind and

  • 33:04

    it's gonna be this presumably space
    it's gonna be this presumably space

  • 33:06

    separated names no kind of sure so
    separated names no kind of sure so

  • 33:09

    they're in Python a nice thing that you
    they're in Python a nice thing that you

  • 33:11

    can do is you can actually do this thing
    can do is you can actually do this thing

  • 33:13

    called split and split a string okay so
    called split and split a string okay so

  • 33:16

    let's go into the end of the terminal
    let's go into the end of the terminal

  • 33:17

    here and actually pull up the
    here and actually pull up the

  • 33:19

    interpreter and you know I like this
    interpreter and you know I like this

  • 33:20

    because you just want to play yeah
    because you just want to play yeah

  • 33:22

    exactly
    exactly

  • 33:22

    let's just get a sense of what the
    let's just get a sense of what the

  • 33:24

    function looks like and so I'm indeed
    function looks like and so I'm indeed

  • 33:26

    answered the questions in the chat yes
    answered the questions in the chat yes

  • 33:28

    we're essentially at the moment just
    we're essentially at the moment just

  • 33:29

    trying to get the first word in the last
    trying to get the first word in the last

  • 33:30

    word yeah so we'll say let's say I have
    word yeah so we'll say let's say I have

  • 33:33

    Colton Ogden here in a string and I want
    Colton Ogden here in a string and I want

  • 33:36

    to split it into its constituents
    to split it into its constituents

  • 33:38

    because so I'll just do thoughts split
    because so I'll just do thoughts split

  • 33:40

    which is another method inside of the
    which is another method inside of the

  • 33:43

    string class exactly and well we have
    string class exactly and well we have

  • 33:45

    some interesting syntax here but it
    some interesting syntax here but it

  • 33:47

    looks like it did find my first name and
    looks like it did find my first name and

  • 33:50

    it separated out my last name and what
    it separated out my last name and what

  • 33:52

    are these square brackets around you why
    are these square brackets around you why

  • 33:54

    am i seeing that so these square
    am i seeing that so these square

  • 33:55

    brackets are indicative of what you
    brackets are indicative of what you

  • 33:57

    might have seen in java or c an array
    might have seen in java or c an array

  • 34:00

    but in Python it's called a list and the
    but in Python it's called a list and the

  • 34:02

    nice thing about lists and python is
    nice thing about lists and python is

  • 34:04

    that they can be of arbitrary size they
    that they can be of arbitrary size they

  • 34:06

    can grow dynamically you don't have to
    can grow dynamically you don't have to

  • 34:08

    allocate memory for them if you're
    allocate memory for them if you're

  • 34:09

    coming from a more statically based
    coming from a more statically based

  • 34:11

    background yeah and I'm smiling because
    background yeah and I'm smiling because

  • 34:14

    the sandwich in the chat here is
    the sandwich in the chat here is

  • 34:16

    proposing that your sample middle name
    proposing that your sample middle name

  • 34:17

    be Colton McLovin Ogden which is a great
    be Colton McLovin Ogden which is a great

  • 34:20

    reference to a great movie question here
    reference to a great movie question here

  • 34:22

    about can we use the in operator from
    about can we use the in operator from

  • 34:24

    Richard because if the name is double
    Richard because if the name is double

  • 34:26

    bare bare double barrelled that wouldn't
    bare bare double barrelled that wouldn't

  • 34:29

    work so in just tests for the presence
    work so in just tests for the presence

  • 34:31

    of a
    of a

  • 34:32

    string anywhere and the string beginning
    string anywhere and the string beginning

  • 34:34

    middle end or anywhere else in between
    middle end or anywhere else in between

  • 34:36

    so it doesn't feel like the right fit we
    so it doesn't feel like the right fit we

  • 34:38

    deliberately want to check the beginning
    deliberately want to check the beginning

  • 34:39

    and the end so I think the road we're
    and the end so I think the road we're

  • 34:41

    going down is at least one approach that
    going down is at least one approach that

  • 34:43

    we can take yeah can someone who says
    we can take yeah can someone who says

  • 34:45

    stir it up fine as well but again I
    stir it up fine as well but again I

  • 34:46

    think that would also do lead us down
    think that would also do lead us down

  • 34:49

    the same track something stir it up find
    the same track something stir it up find

  • 34:50

    just literally finds whether and not a
    just literally finds whether and not a

  • 34:54

    vision asks what if someone has to plus
    vision asks what if someone has to plus

  • 34:55

    middle names that - we want to be
    middle names that - we want to be

  • 34:57

    sensitive - so how it let's let's go
    sensitive - so how it let's let's go

  • 34:59

    ahead and well I don't I don't just like
    ahead and well I don't I don't just like

  • 35:01

    the approach you're taking just
    the approach you're taking just

  • 35:02

    splitting on the strings but how do I go
    splitting on the strings but how do I go

  • 35:03

    about checking for colton at the
    about checking for colton at the

  • 35:05

    beginning in Ogden to the end and can we
    beginning in Ogden to the end and can we

  • 35:07

    try and like mclovin and maybe a
    try and like mclovin and maybe a

  • 35:08

    two-word middle name just to see what
    two-word middle name just to see what

  • 35:10

    the result looks like yeah I know what
    the result looks like yeah I know what

  • 35:12

    to code for so calling the glove and
    to code for so calling the glove and

  • 35:13

    Hodgdon
    Hodgdon

  • 35:14

    which is fantastic and actually you have
    which is fantastic and actually you have

  • 35:15

    three you have a David J Malan as your
    three you have a David J Malan as your

  • 35:18

    name we'll use that as well so let's
    name we'll use that as well so let's

  • 35:19

    split that so again it worked just like
    split that so again it worked just like

  • 35:22

    you did before even though we have three
    you did before even though we have three

  • 35:24

    names instead of two it's split on
    names instead of two it's split on

  • 35:25

    spaces
    spaces

  • 35:26

    can I see four names that's this good
    can I see four names that's this good

  • 35:28

    we'll see David J McLovin Mela nice
    we'll see David J McLovin Mela nice

  • 35:32

    that's a mouthful and we'll split that
    that's a mouthful and we'll split that

  • 35:34

    and okay so every string from the
    and okay so every string from the

  • 35:37

    original string ends up inside of the
    original string ends up inside of the

  • 35:40

    list it does so really we want to check
    list it does so really we want to check

  • 35:42

    the beginning of the list and the end of
    the beginning of the list and the end of

  • 35:43

    the list for Colton and Ogden and
    the list for Colton and Ogden and

  • 35:46

    unhappiness we do and lists are nice in
    unhappiness we do and lists are nice in

  • 35:48

    that you can just reference if you want
    that you can just reference if you want

  • 35:51

    a specific spot in the list you can say
    a specific spot in the list you can say

  • 35:53

    let's make a list here which has five
    let's make a list here which has five

  • 35:55

    numbers in it well actually for
    numbers in it well actually for

  • 35:57

    confusion let's not do that let's say I
    confusion let's not do that let's say I

  • 35:58

    have apple orange and banana as a list
    have apple orange and banana as a list

  • 36:03

    and we can have just use our names as
    and we can have just use our names as

  • 36:04

    well but if I want to get a specific
    well but if I want to get a specific

  • 36:08

    element from the list I can use what's
    element from the list I can use what's

  • 36:11

    called an index and this is a numerical
    called an index and this is a numerical

  • 36:13

    index so lists start their ordering of
    index so lists start their ordering of

  • 36:17

    their elements at zero so for example in
    their elements at zero so for example in

  • 36:20

    this case L at index zero is Apple and
    this case L at index zero is Apple and

  • 36:24

    wise one if it's the first element cuz
    wise one if it's the first element cuz

  • 36:26

    computer scientist
    computer scientist

  • 36:28

    that zero is how they like to start
    that zero is how they like to start

  • 36:30

    numbering things in a program three
    numbering things in a program three

  • 36:32

    things you know what Lua is one indexed
    things you know what Lua is one indexed

  • 36:34

    scratch just wounded next to yeah okay
    scratch just wounded next to yeah okay

  • 36:37

    presumably for user-friendliness maybe
    presumably for user-friendliness maybe

  • 36:39

    because Lua
    because Lua

  • 36:39

    I know Lua was originally designed as a
    I know Lua was originally designed as a

  • 36:41

    config language for less technical
    config language for less technical

  • 36:43

    people and then scratch is a programming
    people and then scratch is a programming

  • 36:45

    environment for people that are fresh to
    environment for people that are fresh to

  • 36:46

    programming in computer science but
    programming in computer science but

  • 36:48

    ironically it just ends up confusing
    ironically it just ends up confusing

  • 36:49

    because then they eventually have to
    because then they eventually have to

  • 36:50

    change yeah their transition to C or the
    change yeah their transition to C or the

  • 36:52

    Java or whatever now what's this is zero
    Java or whatever now what's this is zero

  • 36:54

    is that a number one on the left no
    is that a number one on the left no

  • 36:56

    that's an L and L is just a shorthand in
    that's an L and L is just a shorthand in

  • 36:59

    this case for a variable for list L for
    this case for a variable for list L for

  • 37:01

    lips and you can this is typically
    lips and you can this is typically

  • 37:03

    frowned upon you don't want to use a
    frowned upon you don't want to use a

  • 37:04

    letter as a variable name for most
    letter as a variable name for most

  • 37:07

    circumstances outside of maybe some
    circumstances outside of maybe some

  • 37:09

    context we'll we'll get to a little bit
    context we'll we'll get to a little bit

  • 37:10

    later but in this case I just wanted a
    later but in this case I just wanted a

  • 37:12

    quick list so I'm gonna just use L again
    quick list so I'm gonna just use L again

  • 37:14

    and what L looks like a one and a mono
    and what L looks like a one and a mono

  • 37:16

    spaced font if I use these brackets just
    spaced font if I use these brackets just

  • 37:19

    like we did for the actual to actually
    like we did for the actual to actually

  • 37:21

    show the list itself but I say L at
    show the list itself but I say L at

  • 37:24

    index zero this is how you can almost
    index zero this is how you can almost

  • 37:26

    like almost like a box if we're thinking
    like almost like a box if we're thinking

  • 37:28

    about it like there's little boxes
    about it like there's little boxes

  • 37:30

    little cubbies for each individual spot
    little cubbies for each individual spot

  • 37:31

    in our list
    in our list

  • 37:32

    mm-hm if we do this we'll see that L at
    mm-hm if we do this we'll see that L at

  • 37:35

    index zero returns Apple okay L at index
    index zero returns Apple okay L at index

  • 37:38

    1 gives us orange I am and L at index 2
    1 gives us orange I am and L at index 2

  • 37:41

    gives us banana so everything is
    gives us banana so everything is

  • 37:43

    sequentially laid out and what fruit are
    sequentially laid out and what fruit are

  • 37:45

    we gonna see it L bracket 3 ooh
    we gonna see it L bracket 3 ooh

  • 37:47

    that's a good question it looks like
    that's a good question it looks like

  • 37:49

    Python is smart enough to know at
    Python is smart enough to know at

  • 37:51

    runtime whether or not we're actually
    runtime whether or not we're actually

  • 37:53

    indexing outside of the rainbow we've
    indexing outside of the rainbow we've

  • 37:55

    allocated for our list so in languages
    allocated for our list so in languages

  • 37:57

    like C and C++ by default you're
    like C and C++ by default you're

  • 37:59

    typically going to see no error but
    typically going to see no error but

  • 38:02

    you're gonna be touching memory you
    you're gonna be touching memory you

  • 38:03

    shouldn't or the program could even
    shouldn't or the program could even

  • 38:04

    crash if you do something like this this
    crash if you do something like this this

  • 38:06

    of course is an exception we'll talk
    of course is an exception we'll talk

  • 38:07

    about that perhaps in another stream but
    about that perhaps in another stream but

  • 38:09

    it's a way of handling errors and
    it's a way of handling errors and

  • 38:10

    similarly what is l bracket negative 1
    similarly what is l bracket negative 1

  • 38:13

    for instance can we go to the left oh
    for instance can we go to the left oh

  • 38:15

    yeah solutely so L bracket negative 1
    yeah solutely so L bracket negative 1

  • 38:17

    now this this would cause chaos I think
    now this this would cause chaos I think

  • 38:19

    if you I'm really worried about this is
    if you I'm really worried about this is

  • 38:21

    gonna break the computer Oh interesting
    gonna break the computer Oh interesting

  • 38:24

    so Nana L negative one gave us it looks
    so Nana L negative one gave us it looks

  • 38:27

    like banana the last element of our list
    like banana the last element of our list

  • 38:30

    interesting now why is that well it
    interesting now why is that well it

  • 38:32

    looks like it turns out that in Python
    looks like it turns out that in Python

  • 38:34

    you actually get this nice little
    you actually get this nice little

  • 38:36

    syntactic sugar for indexing into your
    syntactic sugar for indexing into your

  • 38:38

    array from the
    array from the

  • 38:39

    and not the head so to speak the end of
    and not the head so to speak the end of

  • 38:41

    the list as opposed to the beginning and
    the list as opposed to the beginning and

  • 38:43

    you know starting at negative one and
    you know starting at negative one and

  • 38:45

    going and backwards negative two
    going and backwards negative two

  • 38:47

    negative three you go from the end of
    negative three you go from the end of

  • 38:49

    the list actually to the front of the
    the list actually to the front of the

  • 38:51

    list of the head of the list so what's
    list of the head of the list so what's

  • 38:52

    l-bracket negative to going to bell
    l-bracket negative to going to bell

  • 38:55

    bracket negative 2 gives us orange which
    bracket negative 2 gives us orange which

  • 38:57

    is again one further from the back of
    is again one further from the back of

  • 38:59

    the list an L Bergen negative 3 o and
    the list an L Bergen negative 3 o and

  • 39:02

    indeed all right so this is actually
    indeed all right so this is actually

  • 39:04

    really handy when you want to do
    really handy when you want to do

  • 39:05

    something relative to the end of the
    something relative to the end of the

  • 39:07

    list but you don't want to have to do
    list but you don't want to have to do

  • 39:08

    all of the math yourself necessarily you
    all of the math yourself necessarily you

  • 39:10

    can just jump immediately to the end if
    can just jump immediately to the end if

  • 39:12

    you know the index but the catch here is
    you know the index but the catch here is

  • 39:14

    that I think when we go back to your
    that I think when we go back to your

  • 39:15

    text editor we need to be robust against
    text editor we need to be robust against

  • 39:18

    names with two words three words four
    names with two words three words four

  • 39:21

    words so how can we go about modifying
    words so how can we go about modifying

  • 39:23

    this program now in hello dot pi to
    this program now in hello dot pi to

  • 39:25

    check that the first element in the list
    check that the first element in the list

  • 39:27

    is Colton the last element is Alden but
    is Colton the last element is Alden but

  • 39:30

    we don't really care how many other
    we don't really care how many other

  • 39:31

    things are in between because I don't
    things are in between because I don't

  • 39:33

    think we can hard code 0 + + 2 or 0 + 3
    think we can hard code 0 + + 2 or 0 + 3

  • 39:37

    we need to figure out how many elements
    we need to figure out how many elements

  • 39:39

    are in the list first right sure so our
    are in the list first right sure so our

  • 39:42

    first step would be again to break the
    first step would be again to break the

  • 39:44

    string up into its constituent parts
    string up into its constituent parts

  • 39:46

    inside the split method so we can do
    inside the split method so we can do

  • 39:49

    that here so we can say if well there's
    that here so we can say if well there's

  • 39:51

    a few approaches we can do this we could
    a few approaches we can do this we could

  • 39:53

    do names and actually take name dot
    do names and actually take name dot

  • 39:57

    split nice and now we actually have
    split nice and now we actually have

  • 39:59

    another variable not with the whole
    another variable not with the whole

  • 40:01

    string but with the individual names
    string but with the individual names

  • 40:03

    that make up the string that we passed
    that make up the string that we passed

  • 40:05

    in okay nice so now what we can do is we
    in okay nice so now what we can do is we

  • 40:07

    can say if names 0 because I remember
    can say if names 0 because I remember

  • 40:10

    again if we're doing if we're indexing
    again if we're doing if we're indexing

  • 40:12

    into our list at index 0 that's the very
    into our list at index 0 that's the very

  • 40:15

    first element in our list and we want to
    first element in our list and we want to

  • 40:17

    check to see if my first name if the
    check to see if my first name if the

  • 40:18

    first name in the list that we've
    first name in the list that we've

  • 40:19

    entered is Colton that's what we care
    entered is Colton that's what we care

  • 40:21

    about so we'll just say if names 0
    about so we'll just say if names 0

  • 40:24

    equals Colton and now here's the thing
    equals Colton and now here's the thing

  • 40:26

    there are two conditions though because
    there are two conditions though because

  • 40:28

    we could get a Colton Jackson a Colton
    we could get a Colton Jackson a Colton

  • 40:30

    Smith or what-have-you but we care
    Smith or what-have-you but we care

  • 40:32

    specifically about Colton Ogden you know
    specifically about Colton Ogden you know

  • 40:34

    and so the others are delightful this is
    and so the others are delightful this is

  • 40:37

    there are two actually two conditions
    there are two actually two conditions

  • 40:39

    here that we care about not just one
    here that we care about not just one

  • 40:40

    condition
    condition

  • 40:41

    and the nice thing that Python lets you
    and the nice thing that Python lets you

  • 40:42

    do is actually say okay if I want to
    do is actually say okay if I want to

  • 40:44

    check for two different things I can
    check for two different things I can

  • 40:45

    just say if something and
    just say if something and

  • 40:48

    thing then do something if two things
    thing then do something if two things

  • 40:50

    are true cut so you literally just say
    are true cut so you literally just say

  • 40:52

    and you say and so I'll say if it's the
    and you say and so I'll say if it's the

  • 40:55

    case that names zero is equal to the
    case that names zero is equal to the

  • 40:57

    string Colton and names if I can type
    string Colton and names if I can type

  • 40:59

    names at negative one again the last
    names at negative one again the last

  • 41:02

    element in the list no matter the size
    element in the list no matter the size

  • 41:03

    is equal to Ogden then we want to
    is equal to Ogden then we want to

  • 41:09

    probably not say name dot lower probably
    probably not say name dot lower probably

  • 41:12

    actually just say name dot well in this
    actually just say name dot well in this

  • 41:15

    case we do name not capitalized name
    case we do name not capitalized name

  • 41:16

    stuff what was it title I guess we can
    stuff what was it title I guess we can

  • 41:18

    do name that title and then name that
    do name that title and then name that

  • 41:20

    title again for the actual printing out
    title again for the actual printing out

  • 41:23

    okay
    okay

  • 41:24

    you know the other thing here though is
    you know the other thing here though is

  • 41:26

    that if it's if in this case we
    that if it's if in this case we

  • 41:29

    literally have the string Colton or
    literally have the string Colton or

  • 41:30

    literally this chain table then it'll
    literally this chain table then it'll

  • 41:32

    work but if we have if we've missed
    work but if we have if we've missed

  • 41:34

    types like we talked about before it's
    types like we talked about before it's

  • 41:36

    not gonna work yeah I don't like that so
    not gonna work yeah I don't like that so

  • 41:38

    where should we do the lowercase trick
    where should we do the lowercase trick

  • 41:40

    for instance like we did last time so
    for instance like we did last time so

  • 41:42

    what we can do is I can say name dot
    what we can do is I can say name dot

  • 41:45

    again lower and force everything to
    again lower and force everything to

  • 41:49

    lowercase initially split exactly so
    lowercase initially split exactly so

  • 41:51

    you'll get back a whole bunch of
    you'll get back a whole bunch of

  • 41:52

    lowercase pieces now yeah this name even
    lowercase pieces now yeah this name even

  • 41:55

    with the spaces all of the words all the
    with the spaces all of the words all the

  • 41:57

    letters that are alphanumeric are
    letters that are alphanumeric are

  • 41:58

    specifically alphabetical or going to be
    specifically alphabetical or going to be

  • 42:00

    given a lower K they're lowercase
    given a lower K they're lowercase

  • 42:02

    version okay and so then after that I
    version okay and so then after that I

  • 42:04

    can change
    can change

  • 42:05

    now we're not comparing for the
    now we're not comparing for the

  • 42:06

    capitalized C we're actually comparing
    capitalized C we're actually comparing

  • 42:08

    for the lowercase because everything's
    for the lowercase because everything's

  • 42:09

    been canonicalized names okay it's then
    been canonicalized names okay it's then

  • 42:12

    once we've done that now when we render
    once we've done that now when we render

  • 42:14

    it when we actually display the name we
    it when we actually display the name we

  • 42:16

    don't want to display a lowercase
    don't want to display a lowercase

  • 42:16

    because then look that look weird in
    because then look that look weird in

  • 42:18

    despite what they've typed it'll look
    despite what they've typed it'll look

  • 42:19

    different we want to clean it up we want
    different we want to clean it up we want

  • 42:22

    to give it the title aged version yeah
    to give it the title aged version yeah

  • 42:23

    okay so let's actually try and run this
    okay so let's actually try and run this

  • 42:25

    now assuming that I don't have any
    now assuming that I don't have any

  • 42:27

    errors in here let me exit the
    errors in here let me exit the

  • 42:28

    interpreter clear my screen and then run
    interpreter clear my screen and then run

  • 42:30

    my hello dot pi so let's test it out
    my hello dot pi so let's test it out

  • 42:33

    let's say David J Malan oh wow
    let's say David J Malan oh wow

  • 42:39

    internationally and actually printed
    internationally and actually printed

  • 42:41

    your name and it's happy to see you it
    your name and it's happy to see you it

  • 42:42

    is which is good let's go ahead and tie
    is which is good let's go ahead and tie

  • 42:45

    it let's try a Colton will use my actual
    it let's try a Colton will use my actual

  • 42:48

    full name Colton Taylor Ogden
    full name Colton Taylor Ogden

  • 42:50

    oh I'm happy to see you and happy to see
    oh I'm happy to see you and happy to see

  • 42:53

    me what about Colton McLovin yeah what
    me what about Colton McLovin yeah what

  • 42:54

    about coffee done Colton McLovin Ogden
    about coffee done Colton McLovin Ogden

  • 42:57

    looks like it knows it's you Missy still
    looks like it knows it's you Missy still

  • 43:00

    knows this mean I wouldn't
    knows this mean I wouldn't

  • 43:01

    Colton was try Colton McLovin Smith he's
    Colton was try Colton McLovin Smith he's

  • 43:07

    fine
    fine

  • 43:07

    he's cool that's a different Colton what
    he's cool that's a different Colton what

  • 43:09

    about just Colton okay let's try that
    about just Colton okay let's try that

  • 43:11

    hello this was suggested in the chat if
    hello this was suggested in the chat if

  • 43:13

    we just have one name oh it looks like
    we just have one name oh it looks like

  • 43:16

    it's happy to see interesting cuz it
    it's happy to see interesting cuz it

  • 43:17

    really is the Ogden that we don't like
    really is the Ogden that we don't like

  • 43:19

    correct interest any Colton and
    correct interest any Colton and

  • 43:22

    specifically if your string is one
    specifically if your string is one

  • 43:24

    element long and you do negative 1 and 0
    element long and you do negative 1 and 0

  • 43:27

    these are identical you get the same
    these are identical you get the same

  • 43:29

    element because your your list is only
    element because your your list is only

  • 43:31

    one size so from the bottom and from the
    one size so from the bottom and from the

  • 43:33

    front it's making the same steps to get
    front it's making the same steps to get

  • 43:34

    to the same value and I see Osley
    to the same value and I see Osley

  • 43:37

    underscore t asks can you also do name 0
    underscore t asks can you also do name 0

  • 43:39

    lower you can but then you're gonna end
    lower you can but then you're gonna end

  • 43:41

    up calling lower in two places because
    up calling lower in two places because

  • 43:43

    you're gonna do it on names bracket 0
    you're gonna do it on names bracket 0

  • 43:44

    and names bracket negative 1 it's not
    and names bracket negative 1 it's not

  • 43:46

    wrong it's just you're literally calling
    wrong it's just you're literally calling

  • 43:48

    the function twice as many places as you
    the function twice as many places as you

  • 43:50

    need to so I like what Colton did by
    need to so I like what Colton did by

  • 43:51

    elevating it to this other temporary
    elevating it to this other temporary

  • 43:53

    variable the pieces that end up in the
    variable the pieces that end up in the

  • 43:56

    names variable as well this is where you
    names variable as well this is where you

  • 43:58

    get points for star for design
    get points for star for design

  • 43:59

    specifically would you bucket eyes this
    specifically would you bucket eyes this

  • 44:02

    as design this would be designed right
    as design this would be designed right

  • 44:04

    yeah this is design I would say style
    yeah this is design I would say style

  • 44:05

    would be more about the indentation
    would be more about the indentation

  • 44:07

    whether your variables are named
    whether your variables are named

  • 44:08

    correctly but design is like the actual
    correctly but design is like the actual

  • 44:10

    how you arrange your function calls and
    how you arrange your function calls and

  • 44:13

    sort of mold your data to accomplish the
    sort of mold your data to accomplish the

  • 44:15

    task at hand so I think if folks are
    task at hand so I think if folks are

  • 44:17

    comfy I think there's a nice opportunity
    comfy I think there's a nice opportunity

  • 44:19

    here even though the program is pretty
    here even though the program is pretty

  • 44:20

    small to kind of take things to the next
    small to kind of take things to the next

  • 44:23

    level and introduce a more advanced
    level and introduce a more advanced

  • 44:24

    topic known as regular expressions okay
    topic known as regular expressions okay

  • 44:26

    regular expressions allow you to check
    regular expressions allow you to check

  • 44:28

    for patterns of user input which is nice
    for patterns of user input which is nice

  • 44:30

    because what Colton's something
    because what Colton's something

  • 44:32

    something Ogden really is it's a pattern
    something Ogden really is it's a pattern

  • 44:34

    and we're being very deliberate right
    and we're being very deliberate right

  • 44:36

    now in splitting the string on space
    now in splitting the string on space

  • 44:38

    checking the first for Colton checking
    checking the first for Colton checking

  • 44:40

    the last for Ogden but it turns out
    the last for Ogden but it turns out

  • 44:42

    there's a general purpose tool by which
    there's a general purpose tool by which

  • 44:43

    you can just do this by expressing
    you can just do this by expressing

  • 44:45

    yourself in terms of a pattern and not
    yourself in terms of a pattern and not

  • 44:47

    really getting into these lower level
    really getting into these lower level

  • 44:49

    implementation details of splitting a
    implementation details of splitting a

  • 44:50

    string and checking this and checking
    string and checking this and checking

  • 44:52

    that would you mind walking us through
    that would you mind walking us through

  • 44:53

    an alternative solution that uses
    an alternative solution that uses

  • 44:55

    regular expressions instead of splits
    regular expressions instead of splits

  • 44:58

    and these equality tests on the heels of
    and these equality tests on the heels of

  • 45:00

    that Davis 216 says oh god not regular
    that Davis 216 says oh god not regular

  • 45:02

    expressions oh here we go Davis these
    expressions oh here we go Davis these

  • 45:03

    are great it's a great you're gonna
    are great it's a great you're gonna

  • 45:04

    build them up for us step by step baby
    build them up for us step by step baby

  • 45:06

    steps if you will so I know they didn't
    steps if you will so I know they didn't

  • 45:08

    Python Python ships with a module called
    Python Python ships with a module called

  • 45:12

    our e in a module in Python
    our e in a module in Python

  • 45:14

    just a library that you have access to
    just a library that you have access to

  • 45:16

    well specifically the module in Python
    well specifically the module in Python

  • 45:18

    is a folder with a specific file in it
    is a folder with a specific file in it

  • 45:20

    but modules as they're commonly known in
    but modules as they're commonly known in

  • 45:23

    Python are just libraries that ship with
    Python are just libraries that ship with

  • 45:24

    this the with the language itself part
    this the with the language itself part

  • 45:27

    of the standard library so you can do
    of the standard library so you can do

  • 45:29

    something at the very top of your
    something at the very top of your

  • 45:31

    program like import re re being short
    program like import re re being short

  • 45:34

    for of course regular expressions
    for of course regular expressions

  • 45:35

    regular expression and I might have to
    regular expression and I might have to

  • 45:38

    refresh my memory on how to actually use
    refresh my memory on how to actually use

  • 45:39

    this library because it's a little while
    this library because it's a little while

  • 45:40

    but this is what we have Google points
    but this is what we have Google points

  • 45:42

    Mahlon but re a regular expression is
    Mahlon but re a regular expression is

  • 45:46

    pretty cool it allows you to actually
    pretty cool it allows you to actually

  • 45:47

    specify sort of a string pattern a
    specify sort of a string pattern a

  • 45:50

    grammar so to speak for what you're
    grammar so to speak for what you're

  • 45:52

    looking for what how you want to
    looking for what how you want to

  • 45:54

    actually parse your string extract data
    actually parse your string extract data

  • 45:56

    from it you know test whether it fits
    from it you know test whether it fits

  • 45:58

    some kind of not hard-coded you know
    some kind of not hard-coded you know

  • 46:01

    Colton Ogden but whether it's something
    Colton Ogden but whether it's something

  • 46:02

    a little bit more complicated hmm
    a little bit more complicated hmm

  • 46:05

    so in this case so what do we how do we
    so in this case so what do we how do we

  • 46:06

    want to do this we want to use re just a
    want to do this we want to use re just a

  • 46:08

    test for Colton Ogden or I want a Colton
    test for Colton Ogden or I want a Colton

  • 46:11

    at the beginning and Ogden at the end
    at the beginning and Ogden at the end

  • 46:12

    and I'll take anything in between and I
    and I'll take anything in between and I

  • 46:14

    don't care about capitalization I go
    don't care about capitalization I go

  • 46:16

    away
    away

  • 46:16

    okay sure now we should note there's a
    okay sure now we should note there's a

  • 46:18

    few there's a little bit of nervousness
    few there's a little bit of nervousness

  • 46:19

    in the chat and that's fine and I do
    in the chat and that's fine and I do

  • 46:21

    think you'll find that once we introduce
    think you'll find that once we introduce

  • 46:23

    this sort of piecewise a little bit by
    this sort of piecewise a little bit by

  • 46:26

    little bit honestly you'll found these
    little bit honestly you'll found these

  • 46:27

    pretty straightforward and pretty
    pretty straightforward and pretty

  • 46:28

    powerful with that said sometimes they
    powerful with that said sometimes they

  • 46:31

    get crazy complicated and literally a
    get crazy complicated and literally a

  • 46:32

    day or two ago that I email a colleague
    day or two ago that I email a colleague

  • 46:35

    saying hey how do i express this in a
    saying hey how do i express this in a

  • 46:37

    regular expression because even I get
    regular expression because even I get

  • 46:38

    rusty on it sometimes but we're gonna
    rusty on it sometimes but we're gonna

  • 46:40

    take it slow and make this pretty pretty
    take it slow and make this pretty pretty

  • 46:42

    compelling yeah you said there's
    compelling yeah you said there's

  • 46:43

    nervousness in the chat a little
    nervousness in the chat a little

  • 46:44

    nervousness here in person oh I'm gonna
    nervousness here in person oh I'm gonna

  • 46:46

    I'll be honest with you but we'll figure
    I'll be honest with you but we'll figure

  • 46:48

    it out it's okay this is a judgment-free
    it out it's okay this is a judgment-free

  • 46:50

    zone over here notice so there are a few
    zone over here notice so there are a few

  • 46:55

    functions that I know that exists in our
    functions that I know that exists in our

  • 46:57

    e and you can do what's called compiling
    e and you can do what's called compiling

  • 47:00

    regular expression where you actually
    regular expression where you actually

  • 47:02

    create an object that takes in a regular
    create an object that takes in a regular

  • 47:04

    expression string and sort of creates an
    expression string and sort of creates an

  • 47:06

    object that you can then use to do
    object that you can then use to do

  • 47:08

    matches more efficiently down the line
    matches more efficiently down the line

  • 47:10

    alternatively you can do something
    alternatively you can do something

  • 47:12

    called re match which doesn't take a
    called re match which doesn't take a

  • 47:14

    compiled regular expression but just
    compiled regular expression but just

  • 47:16

    kind of does it on
    kind of does it on

  • 47:17

    little bit more on the fly this is based
    little bit more on the fly this is based

  • 47:18

    on my memory it can be wrong we'll find
    on my memory it can be wrong we'll find

  • 47:20

    out very shortly so if I say so right
    out very shortly so if I say so right

  • 47:23

    now we're getting the the name so please
    now we're getting the the name so please

  • 47:25

    into your name and you know regular
    into your name and you know regular

  • 47:28

    persons are nice in that you actually
    persons are nice in that you actually

  • 47:29

    don't need to test forgot lower in this
    don't need to test forgot lower in this

  • 47:31

    case you know you can express that
    case you know you can express that

  • 47:33

    different like yeah you can you can use
    different like yeah you can you can use

  • 47:34

    a regular expression actually to say hey
    a regular expression actually to say hey

  • 47:37

    regardless of case is this match Colton
    regardless of case is this match Colton

  • 47:40

    Ogden so actually I'm gonna get rid of
    Ogden so actually I'm gonna get rid of

  • 47:41

    this dot lower I'm actually gonna get
    this dot lower I'm actually gonna get

  • 47:44

    rid of split and I actually gonna get
    rid of split and I actually gonna get

  • 47:46

    rid of names altogether because I'm not
    rid of names altogether because I'm not

  • 47:48

    gonna need a list and I'm actually gonna
    gonna need a list and I'm actually gonna

  • 47:50

    get rid of this if state this is what's
    get rid of this if state this is what's

  • 47:51

    getting cool I mean I know there's some
    getting cool I mean I know there's some

  • 47:53

    nerves there but this program is gonna
    nerves there but this program is gonna

  • 47:54

    actually end up being shorter using a
    actually end up being shorter using a

  • 47:56

    regular expression now I'm gonna start
    regular expression now I'm gonna start

  • 47:58

    using our this function called re-match
    using our this function called re-match

  • 48:01

    okay and it looks like this we'll try to
    okay and it looks like this we'll try to

  • 48:03

    apply the pattern at the start of
    apply the pattern at the start of

  • 48:04

    whatever string we pass into it so it's
    whatever string we pass into it so it's

  • 48:06

    gonna take a pattern and re patter regex
    gonna take a pattern and re patter regex

  • 48:08

    pattern rejecting stuff rate of
    pattern rejecting stuff rate of

  • 48:09

    expressions so I'm gonna say if re match
    expressions so I'm gonna say if re match

  • 48:12

    and I'm gonna use this an R string which
    and I'm gonna use this an R string which

  • 48:16

    is just a regular expression string and
    is just a regular expression string and

  • 48:17

    actually will serve raw string broccoli
    actually will serve raw string broccoli

  • 48:19

    and it will format it a little bit
    and it will format it a little bit

  • 48:21

    differently electric show you things a
    differently electric show you things a

  • 48:22

    little bit differently and now I'm a
    little bit differently and now I'm a

  • 48:25

    little rusty with my zip with my regular
    little rusty with my zip with my regular

  • 48:27

    expressions today oh but I want to
    expressions today oh but I want to

  • 48:33

    basically do C or C and then Oulton
    basically do C or C and then Oulton

  • 48:39

    space actually and I think I might be
    space actually and I think I might be

  • 48:42

    misremembering space it's either that or
    misremembering space it's either that or

  • 48:45

    that I think one of the two is the
    that I think one of the two is the

  • 48:47

    opposite there's some deep breathing in
    opposite there's some deep breathing in

  • 48:49

    the chat but if you're in the chat you
    the chat but if you're in the chat you

  • 48:50

    know a little bit about regular
    know a little bit about regular

  • 48:51

    expressions by all means chime in here
    expressions by all means chime in here

  • 48:53

    and paste your ideas you can do this in
    and paste your ideas you can do this in

  • 48:55

    bunches of different ways and we'll give
    bunches of different ways and we'll give

  • 48:57

    you one or more along the way here so
    you one or more along the way here so

  • 49:00

    and then what we want to do actually is
    and then what we want to do actually is

  • 49:03

    say plus for an arbitrary number of
    say plus for an arbitrary number of

  • 49:07

    spaces now this might not be the correct
    spaces now this might not be the correct

  • 49:09

    character I'm going to I'm gonna try it
    character I'm going to I'm gonna try it

  • 49:11

    here so let's let's just run it and then
    here so let's let's just run it and then

  • 49:14

    if this is wrong we will we'll do a
    if this is wrong we will we'll do a

  • 49:16

    little bit of it well do a little bit of
    little bit of it well do a little bit of

  • 49:17

    googling and oh I forgot you can see it
    googling and oh I forgot you can see it

  • 49:19

    when I make faces at the camera there
    when I make faces at the camera there

  • 49:20

    right
    right

  • 49:22

    we'll go to a website that I like called
    we'll go to a website that I like called

  • 49:24

    regex pal okay so please enter your name
    regex pal okay so please enter your name

  • 49:27

    let's say Colton Ogden Oh missing one
    let's say Colton Ogden Oh missing one

  • 49:30

    required position oh okay we have to
    required position oh okay we have to

  • 49:32

    actually do it on the string itself so
    actually do it on the string itself so

  • 49:34

    we need to say Nate okay let's try it so
    we need to say Nate okay let's try it so

  • 49:37

    you're gonna match this pattern right
    you're gonna match this pattern right

  • 49:38

    left against this variable on the right
    left against this variable on the right

  • 49:40

    right correct and that's do that so say
    right correct and that's do that so say

  • 49:42

    enter my name Colton Ogden oh it's I'm
    enter my name Colton Ogden oh it's I'm

  • 49:46

    happy to see you it worked
    happy to see you it worked

  • 49:47

    okay well let's make sure let's make
    okay well let's make sure let's make

  • 49:48

    sure that it actually still works for
    sure that it actually still works for

  • 49:49

    other use cases let's say Colton Taylor
    other use cases let's say Colton Taylor

  • 49:52

    Ogden oh it's happy to see Colton Taylor
    Ogden oh it's happy to see Colton Taylor

  • 49:55

    on me you know what I'm realizing is
    on me you know what I'm realizing is

  • 49:57

    that with all we did was we just said
    that with all we did was we just said

  • 49:58

    check for an arbitrary number of spaces
    check for an arbitrary number of spaces

  • 50:00

    not four characters other characters hmm
    not four characters other characters hmm

  • 50:03

    so that's kind of that is kind of a
    so that's kind of that is kind of a

  • 50:05

    problem so what I probably want to do is
    problem so what I probably want to do is

  • 50:08

    say how do we do this I guess we can
    say how do we do this I guess we can

  • 50:11

    just use dot plus okay and then dot
    just use dot plus okay and then dot

  • 50:13

    essentially means any character and
    essentially means any character and

  • 50:15

    we'll see we'll see if that works let's
    we'll see we'll see if that works let's

  • 50:16

    try that out
    try that out

  • 50:17

    so we'll say Colton Taylor Ogden oh it
    so we'll say Colton Taylor Ogden oh it

  • 50:22

    looks like it's working now intro okay
    looks like it's working now intro okay

  • 50:24

    but what if we do what if we okay let's
    but what if we do what if we okay let's

  • 50:25

    try David J Malin oh it is happy to see
    try David J Malin oh it is happy to see

  • 50:29

    you okay interests did I mess up is
    you okay interests did I mess up is

  • 50:31

    there well what about a four person name
    there well what about a four person name

  • 50:33

    okay let's try it so let's say call it
    okay let's try it so let's say call it

  • 50:36

    up PI Colton Mik love and Taylor Ogden
    up PI Colton Mik love and Taylor Ogden

  • 50:41

    looks like it's indeed unhappy to see me
    looks like it's indeed unhappy to see me

  • 50:43

    still it knows it's babe how about
    still it knows it's babe how about

  • 50:45

    Colton osku P Ogden
    Colton osku P Ogden

  • 50:47

    oh yeah that's gonna be a problem isn't
    oh yeah that's gonna be a problem isn't

  • 50:50

    it okay okay
    it okay okay

  • 50:52

    Colton on CPR game but see the thing is
    Colton on CPR game but see the thing is

  • 50:55

    people know that that's me still yeah
    people know that that's me still yeah

  • 50:57

    but I wanted Colton at the beginning and
    but I wanted Colton at the beginning and

  • 50:59

    Ogden at the end not on colonoscopy so
    Ogden at the end not on colonoscopy so

  • 51:01

    there's a bug here right it's being a
    there's a bug here right it's being a

  • 51:03

    little too generous and it's looking
    little too generous and it's looking

  • 51:05

    apparently for CEO ltn and then anything
    apparently for CEO ltn and then anything

  • 51:08

    else but I want there to be a space
    else but I want there to be a space

  • 51:10

    there so what I want to do is I want to
    there so what I want to do is I want to

  • 51:12

    have at least one space and then an
    have at least one space and then an

  • 51:15

    arbitrary number of care okay backslash
    arbitrary number of care okay backslash

  • 51:17

    backslash s means any space so like
    backslash s means any space so like

  • 51:19

    space bar tab other things too so let's
    space bar tab other things too so let's

  • 51:22

    try that so we'll go here we'll try my
    try that so we'll go here we'll try my

  • 51:25

    name as
    name as

  • 51:25

    Wilton Taylor Ogden which is unhappy to
    Wilton Taylor Ogden which is unhappy to

  • 51:27

    see me and then Colton ah Skippy done
    see me and then Colton ah Skippy done

  • 51:31

    and it's still happy to see me
    and it's still happy to see me

  • 51:34

    okay what is okay I got a little bit
    okay what is okay I got a little bit

  • 51:40

    what about let's try one more
    what about let's try one more

  • 51:43

    how about Colton Colton MOG then all
    how about Colton Colton MOG then all

  • 51:49

    right I do need to have a space before
    right I do need to have a space before

  • 51:51

    that Oh as well okay
    that Oh as well okay

  • 51:53

    um seeing a Hilton mugged and I'm cool
    um seeing a Hilton mugged and I'm cool

  • 51:55

    with that's my soda
    with that's my soda

  • 51:57

    you win a happy face okay so what we
    you win a happy face okay so what we

  • 51:59

    need to do that is to again there's
    need to do that is to again there's

  • 52:00

    there should be a space before the oh
    there should be a space before the oh

  • 52:03

    and I guess I should have explained
    and I guess I should have explained

  • 52:04

    before to here this C bar C just means
    before to here this C bar C just means

  • 52:08

    one of the other that bar just music an
    one of the other that bar just music an

  • 52:11

    or and I'm gonna need to correct you on
    or and I'm gonna need to correct you on

  • 52:13

    that though before long we can I have to
    that though before long we can I have to

  • 52:14

    do that now or come back to you're gonna
    do that now or come back to you're gonna

  • 52:16

    die now let's go alright so if I can
    die now let's go alright so if I can

  • 52:18

    just interject with some some my elder
    just interject with some some my elder

  • 52:21

    wisdom here
    wisdom here

  • 52:21

    so the grab the square brackets here and
    so the grab the square brackets here and

  • 52:24

    here denote what's called a character
    here denote what's called a character

  • 52:27

    class in the regular expression and that
    class in the regular expression and that

  • 52:28

    is a set of one or more characters that
    is a set of one or more characters that

  • 52:32

    you want to treat either of so in this
    you want to treat either of so in this

  • 52:37

    case the vertical bar unfortunately is
    case the vertical bar unfortunately is

  • 52:39

    not necessary because this expression
    not necessary because this expression

  • 52:42

    where we literally give you a capital C
    where we literally give you a capital C

  • 52:44

    or a C that's indeed the role of a carry
    or a C that's indeed the role of a carry

  • 52:46

    well if we did it this way we'd want the
    well if we did it this way we'd want the

  • 52:48

    bar right yes but then parentheses
    bar right yes but then parentheses

  • 52:51

    around it so that it's C or little C
    around it so that it's C or little C

  • 52:53

    like that exactly so that would work as
    like that exactly so that would work as

  • 52:56

    well but I think we should fix it for
    well but I think we should fix it for

  • 52:58

    the Ogden as well and the end all right
    the Ogden as well and the end all right

  • 53:00

    we'll do it like that and then we'll do
    we'll do it like that and then we'll do

  • 53:04

    it like that I like that now but I think
    it like that I like that now but I think

  • 53:07

    person folks in the chat here we're
    person folks in the chat here we're

  • 53:09

    trying to handle some number of names in
    trying to handle some number of names in

  • 53:13

    between Colton and Ogden so the pattern
    between Colton and Ogden so the pattern

  • 53:15

    really is Colton one or more spaces
    really is Colton one or more spaces

  • 53:17

    maybe one or more other words then maybe
    maybe one or more other words then maybe

  • 53:22

    a space than Ogden so it's getting a
    a space than Ogden so it's getting a

  • 53:24

    little complicated now and I can
    little complicated now and I can

  • 53:26

    appreciate this is where some of the
    appreciate this is where some of the

  • 53:27

    pain goes so oh my god we didn't also
    pain goes so oh my god we didn't also

  • 53:29

    cover the the carrot and the dollar sign
    cover the the carrot and the dollar sign

  • 53:32

    no we can now stall and go to those now
    no we can now stall and go to those now

  • 53:34

    instead if you want yeah those are the
    instead if you want yeah those are the

  • 53:36

    probably the easiest part of the whole
    probably the easiest part of the whole

  • 53:37

    folk a so the carrot just means the
    folk a so the carrot just means the

  • 53:39

    string has to start with this okay and
    string has to start with this okay and

  • 53:41

    the dollar sign means the string has to
    the dollar sign means the string has to

  • 53:42

    end with this
    end with this

  • 53:43

    that's true in Connect can i interject
    that's true in Connect can i interject

  • 53:45

    with my uh my older way don't have the
    with my uh my older way don't have the

  • 53:47

    carrot symbol confusingly is not
    carrot symbol confusingly is not

  • 53:49

    necessary here because the match
    necessary here because the match

  • 53:51

    function in python takes is a check from
    function in python takes is a check from

  • 53:53

    the beginning but so let me propose this
    the beginning but so let me propose this

  • 53:54

    let's use our e dot search which is
    let's use our e dot search which is

  • 53:56

    slightly more general purpose and don't
    slightly more general purpose and don't

  • 54:00

    worry about getting hung up on those
    worry about getting hung up on those

  • 54:01

    details for efficiency reasons they can
    details for efficiency reasons they can

  • 54:03

    actually be a good thing but in this
    actually be a good thing but in this

  • 54:04

    case here now we have a general purpose
    case here now we have a general purpose

  • 54:06

    tool the carrot says start the string
    tool the carrot says start the string

  • 54:08

    the dollar sign says end of the string
    the dollar sign says end of the string

  • 54:09

    and now we just need to get everything
    and now we just need to get everything

  • 54:11

    right in between Colton's hair says I
    right in between Colton's hair says I

  • 54:13

    thought I wouldn't have a headache today
    thought I wouldn't have a headache today

  • 54:14

    but here we go thanks Dave okay but
    but here we go thanks Dave okay but

  • 54:15

    again notice what we're doing we're
    again notice what we're doing we're

  • 54:16

    taking baby steps toward getting it
    taking baby steps toward getting it

  • 54:18

    right a little more right a little more
    right a little more right a little more

  • 54:20

    right and then hopefully a hundred
    right and then hopefully a hundred

  • 54:21

    percent right so what we need to express
    percent right so what we need to express

  • 54:23

    in the middle it seems is optionally a
    in the middle it seems is optionally a

  • 54:26

    word and a space again and again and
    word and a space again and again and

  • 54:29

    again and again so how could we do that
    again and again so how could we do that

  • 54:31

    for folks so if we do so essentially
    for folks so if we do so essentially

  • 54:35

    replace this dot plus yeah that feels a
    replace this dot plus yeah that feels a

  • 54:37

    little too luxe cuz da in this case is
    little too luxe cuz da in this case is

  • 54:39

    not a period it means any character I
    not a period it means any character I

  • 54:41

    don't want to do a period we would have
    don't want to do a period we would have

  • 54:42

    to actually backslash escape it exactly
    to actually backslash escape it exactly

  • 54:44

    but that's even worse so let's not do
    but that's even worse so let's not do

  • 54:46

    that okay so we know that we're gonna
    that okay so we know that we're gonna

  • 54:48

    have a space then we're gonna have a
    have a space then we're gonna have a

  • 54:49

    after the Colton and then a space before
    after the Colton and then a space before

  • 54:51

    they Ogden and in between that and
    they Ogden and in between that and

  • 54:53

    arbitrary range of words so I'm going to
    arbitrary range of words so I'm going to

  • 54:58

    say we'll do eight well in this case
    say we'll do eight well in this case

  • 55:00

    also an arbitrary an arbitrary number of
    also an arbitrary an arbitrary number of

  • 55:02

    spaces as well if we want to accommodate
    spaces as well if we want to accommodate

  • 55:07

    possibilities okay and so we'll say if
    possibilities okay and so we'll say if

  • 55:10

    we're not gonna use the dot essentially
    we're not gonna use the dot essentially

  • 55:11

    the wild-card thing we want to
    the wild-card thing we want to

  • 55:12

    accommodate that I'm presumably now what
    accommodate that I'm presumably now what

  • 55:15

    you talked about before with character
    you talked about before with character

  • 55:17

    classes we can actually specify a range
    classes we can actually specify a range

  • 55:20

    of characters using this syntax where we
    of characters using this syntax where we

  • 55:22

    say A to Z capital A to Z lower case
    say A to Z capital A to Z lower case

  • 55:25

    zero to nine which means all numbers and
    zero to nine which means all numbers and

  • 55:27

    this just means all characters from A to
    this just means all characters from A to

  • 55:29

    Z capitalized all and all characters
    Z capitalized all and all characters

  • 55:31

    from A to Z lowercase and all digits
    from A to Z lowercase and all digits

  • 55:33

    from 0 to 9 and I'm guessing that's
    from 0 to 9 and I'm guessing that's

  • 55:35

    probably even a simpler way to do this
    probably even a simpler way to do this

  • 55:36

    with the - W / W would be a word
    with the - W / W would be a word

  • 55:40

    character so it would give you the
    character so it would give you the

  • 55:42

    letters of the alphabet in that case
    letters of the alphabet in that case

  • 55:43

    would we want to do something like you
    would we want to do something like you

  • 55:45

    know I'm okay with using dot to just
    know I'm okay with using dot to just

  • 55:46

    represent any care
    represent any care

  • 55:47

    just cuz I think that'll keep it simpler
    just cuz I think that'll keep it simpler

  • 55:49

    but we can make it more precise if you
    but we can make it more precise if you

  • 55:50

    want okay but so dot something so it's
    want okay but so dot something so it's

  • 55:53

    OB director bus and then a space and
    OB director bus and then a space and

  • 55:55

    then this whole thing really should well
    then this whole thing really should well

  • 56:00

    I guess it would go when it go into
    I guess it would go when it go into

  • 56:01

    square bracket so that actually hundreds
    square bracket so that actually hundreds

  • 56:03

    I think you probably what parentheses
    I think you probably what parentheses

  • 56:04

    okay because you can use parentheses for
    okay because you can use parentheses for

  • 56:06

    grouping you use square brackets for
    grouping you use square brackets for

  • 56:08

    character classes a finite number of
    character classes a finite number of

  • 56:10

    characters that you want to expect and
    characters that you want to expect and

  • 56:12

    then with then this itself or no and
    then with then this itself or no and

  • 56:14

    then a space and then and then this in a
    then a space and then and then this in a

  • 56:17

    bracket and then that with a plus oh
    bracket and then that with a plus oh

  • 56:19

    actually this not that okay and I let me
    actually this not that okay and I let me

  • 56:24

    propose we can simplify get rid of all
    propose we can simplify get rid of all

  • 56:25

    the brackets in the middle there they're
    the brackets in the middle there they're

  • 56:26

    just not necessary
    just not necessary

  • 56:27

    okay so what I'm seeing here is this if
    okay so what I'm seeing here is this if

  • 56:32

    I can read this from left to right we
    I can read this from left to right we

  • 56:34

    want start of the string then give me a
    want start of the string then give me a

  • 56:36

    capital C or a lowercase C right then
    capital C or a lowercase C right then

  • 56:39

    give me Oh
    give me Oh

  • 56:40

    LTO n then give me one or more spaces
    LTO n then give me one or more spaces

  • 56:43

    right so even if you're getting a little
    right so even if you're getting a little

  • 56:45

    overwhelmed right now just take a step
    overwhelmed right now just take a step

  • 56:46

    back and consider okay I understand like
    back and consider okay I understand like

  • 56:48

    the first third of the regular
    the first third of the regular

  • 56:49

    expression so now we're saying in
    expression so now we're saying in

  • 56:51

    parentheses the following group give me
    parentheses the following group give me

  • 56:54

    any character one or more times followed
    any character one or more times followed

  • 56:59

    by a space and I like that and then
    by a space and I like that and then

  • 57:01

    you're saying here with the plus
    you're saying here with the plus

  • 57:03

    whatever I just had in parenthesis allow
    whatever I just had in parenthesis allow

  • 57:05

    me one or more of those but you're
    me one or more of those but you're

  • 57:07

    currently therefore requiring a middle
    currently therefore requiring a middle

  • 57:09

    name because plus means one or more of
    name because plus means one or more of

  • 57:11

    the things so how can you say zero or
    the things so how can you say zero or

  • 57:13

    more of those things
    more of those things

  • 57:14

    Oh actually offhand I don't know we
    Oh actually offhand I don't know we

  • 57:16

    might have to consult Google for this
    might have to consult Google for this

  • 57:18

    okay so regex 0 or more reasonable
    okay so regex 0 or more reasonable

  • 57:22

    search query okay 0 or 1 oh this is 0 or
    search query okay 0 or 1 oh this is 0 or

  • 57:26

    1 it's not we're not going so sometimes
    1 it's not we're not going so sometimes

  • 57:28

    the first hit is not the best thanks
    the first hit is not the best thanks

  • 57:30

    google okay let's try this so wrong
    google okay let's try this so wrong

  • 57:34

    language but it's probably gonna be
    language but it's probably gonna be

  • 57:35

    relevant because languages tend to use
    relevant because languages tend to use

  • 57:37

    the same syntax for regular expressions
    the same syntax for regular expressions

  • 57:39

    okay I'm agitated okay no that's that's
    okay I'm agitated okay no that's that's

  • 57:42

    for a range let's see 0 okay here's 0 or
    for a range let's see 0 okay here's 0 or

  • 57:45

    100 here's okay star is 0 or more
    100 here's okay star is 0 or more

  • 57:49

    okay so that effectively makes it
    okay so that effectively makes it

  • 57:50

    optional some number of times so then we
    optional some number of times so then we

  • 57:53

    don't need this Plus anymore we instead
    don't need this Plus anymore we instead

  • 57:54

    want this star correct and now the only
    want this star correct and now the only

  • 57:57

    thing I would be a little careful of is
    thing I would be a little careful of is

  • 58:00

    this strictly speaking we could have
    this strictly speaking we could have

  • 58:03

    that there but I don't think we need it
    that there but I don't think we need it

  • 58:06

    because if we instead just say give me
    because if we instead just say give me

  • 58:08

    one or more spaces after the optional
    one or more spaces after the optional

  • 58:11

    middle name that should offset it from
    middle name that should offset it from

  • 58:13

    your last name right so if we recap and
    your last name right so if we recap and

  • 58:16

    this is what I would do when making my
    this is what I would do when making my

  • 58:17

    own regular expressions because honestly
    own regular expressions because honestly

  • 58:18

    it's getting confusing so you want to
    it's getting confusing so you want to

  • 58:20

    just break it down again
    just break it down again

  • 58:21

    so this says start at the beginning then
    so this says start at the beginning then

  • 58:23

    give me a capital C or a lowercase C
    give me a capital C or a lowercase C

  • 58:25

    then an O LT o n then go ahead and give
    then an O LT o n then go ahead and give

  • 58:29

    me one or more spaces to separate it
    me one or more spaces to separate it

  • 58:32

    from everything else right then go ahead
    from everything else right then go ahead

  • 58:34

    and give me optionally zero or more
    and give me optionally zero or more

  • 58:37

    times the following stuff the following
    times the following stuff the following

  • 58:40

    stuff is any character one or more times
    stuff is any character one or more times

  • 58:42

    followed by one space or more spaces but
    followed by one space or more spaces but

  • 58:46

    that whole thing is optional so what the
    that whole thing is optional so what the

  • 58:48

    parenthesized expression really
    parenthesized expression really

  • 58:49

    represents is optional middle name
    represents is optional middle name

  • 58:51

    middle name middle name middle name and
    middle name middle name middle name and

  • 58:53

    it repeats and someone commented in the
    it repeats and someone commented in the

  • 58:54

    chat earlier about your theory class
    chat earlier about your theory class

  • 58:56

    being germane if you've ever written
    being germane if you've ever written

  • 58:57

    drawn out on a whiteboard or a piece of
    drawn out on a whiteboard or a piece of

  • 58:59

    paper DFA a deterministic finite
    paper DFA a deterministic finite

  • 59:02

    automaton or an N DFA a
    automaton or an N DFA a

  • 59:03

    non-deterministic find out to Thomas on
    non-deterministic find out to Thomas on

  • 59:05

    the picture you're drawing that has
    the picture you're drawing that has

  • 59:06

    loops like this that is what the star is
    loops like this that is what the star is

  • 59:09

    doing give me one or more of these again
    doing give me one or more of these again

  • 59:11

    and again now that if you've thought if
    and again now that if you've thought if

  • 59:14

    you follow that okay then at the very
    you follow that okay then at the very

  • 59:16

    end we just have some Ogden so that
    end we just have some Ogden so that

  • 59:18

    means give me a capital o or a lowercase
    means give me a capital o or a lowercase

  • 59:20

    O then a GD en end of string so again
    O then a GD en end of string so again

  • 59:24

    crazy complex when you look at it at
    crazy complex when you look at it at

  • 59:26

    first glance but break it down into
    first glance but break it down into

  • 59:28

    those constituent parts and I think
    those constituent parts and I think

  • 59:30

    it'll it'll pop for you as well let's s
    it'll it'll pop for you as well let's s

  • 59:32

    that's actually make sure it works
    that's actually make sure it works

  • 59:33

    so we'll say hello pop quiz it's your
    so we'll say hello pop quiz it's your

  • 59:36

    name Colton Taylor Ogden okay
    name Colton Taylor Ogden okay

  • 59:40

    looks a it works alright always
    looks a it works alright always

  • 59:42

    satisfying we spend all that time a
    satisfying we spend all that time a

  • 59:44

    little nervous I don't think we should
    little nervous I don't think we should

  • 59:45

    test anymore there J Malin nice to see
    test anymore there J Malin nice to see

  • 59:49

    you okay let's try let's try and
    you okay let's try let's try and

  • 59:50

    situation where I just have no middle
    situation where I just have no middle

  • 59:52

    name okay so wise okay and then if we
    name okay so wise okay and then if we

  • 59:56

    try let's let's say we try four names so
    try let's let's say we try four names so

  • 59:58

    make up love and
    make up love and

  • 00:00

    Taylor Hagen looks like it still
    Taylor Hagen looks like it still

  • 01:00:02

    recognizes this
    recognizes this

  • 01:00:03

    so what Colin's doing here is an example
    so what Colin's doing here is an example

  • 01:00:05

    of course just manually testing his code
    of course just manually testing his code

  • 01:00:07

    trying a bunch of inputs once you get
    trying a bunch of inputs once you get

  • 01:00:09

    more comfortable programming can you use
    more comfortable programming can you use

  • 01:00:10

    various tools to automate this testing
    various tools to automate this testing

  • 01:00:12

    so Colton or someone would still have to
    so Colton or someone would still have to

  • 01:00:14

    think about all of those different
    think about all of those different

  • 01:00:16

    examples but you'd save the tests in
    examples but you'd save the tests in

  • 01:00:18

    another file and then run some automated
    another file and then run some automated

  • 01:00:20

    process that would constantly run those
    process that would constantly run those

  • 01:00:22

    sample inputs against your program to
    sample inputs against your program to

  • 01:00:24

    make sure that you haven't messed up and
    make sure that you haven't messed up and

  • 01:00:25

    created a new problem Oh someone
    created a new problem Oh someone

  • 01:00:26

    actually says try only Colton
    actually says try only Colton

  • 01:00:28

    oh come a little nervous okay Cole
    oh come a little nervous okay Cole

  • 01:00:32

    please cool because we don't know if
    please cool because we don't know if

  • 01:00:33

    it's the one we don't like what about
    it's the one we don't like what about

  • 01:00:34

    though Colton odd then in all caps if
    though Colton odd then in all caps if

  • 01:00:37

    you could someone who's yelling they're
    you could someone who's yelling they're

  • 01:00:39

    really just they're yelling your name
    really just they're yelling your name

  • 01:00:41

    there we go Colton Hogg then we didn't
    there we go Colton Hogg then we didn't

  • 01:00:44

    we didn't come back we didn't account
    we didn't come back we didn't account

  • 01:00:46

    for that oh we know we did it no I am
    for that oh we know we did it no I am

  • 01:00:48

    not pleased to see that Colton Ogden
    not pleased to see that Colton Ogden

  • 01:00:49

    either so how do we fix that yeah so
    either so how do we fix that yeah so

  • 01:00:51

    here's the thing what we want to do is
    here's the thing what we want to do is

  • 01:00:53

    get back into lower casing things we
    get back into lower casing things we

  • 01:00:56

    want to go to name dot we could do that
    want to go to name dot we could do that

  • 01:00:58

    way or I think you've read the my face
    way or I think you've read the my face

  • 01:01:01

    there yeah I'm pretty sure we can do
    there yeah I'm pretty sure we can do

  • 01:01:03

    this with regular expressions though we
    this with regular expressions though we

  • 01:01:04

    probably could so we could just do the
    probably could so we could just do the

  • 01:01:06

    same thing that we did before which is
    same thing that we did before which is

  • 01:01:08

    not that we do I guess it might be font
    not that we do I guess it might be font

  • 01:01:12

    oh because I haven't string highlighted
    oh because I haven't string highlighted

  • 01:01:13

    that's why so if I go over here do and
    that's why so if I go over here do and

  • 01:01:17

    oh oh you could just have a whole bunch
    oh oh you could just have a whole bunch

  • 01:01:19

    of characters one for each letter
    of characters one for each letter

  • 01:01:21

    there's probably a more efficient way to
    there's probably a more efficient way to

  • 01:01:23

    but dear god this looks scary
    but dear god this looks scary

  • 01:01:25

    it's kind of cool though too that your
    it's kind of cool though too that your

  • 01:01:27

    name is like duplicated this way yeah so
    name is like duplicated this way yeah so

  • 01:01:29

    you could do this this is correct but I
    you could do this this is correct but I

  • 01:01:31

    would argue bad design why because one
    would argue bad design why because one

  • 01:01:33

    it's just so damn hard to read now it's
    it's just so damn hard to read now it's

  • 01:01:35

    just making this string so much longer
    just making this string so much longer

  • 01:01:37

    and we're not even done with the Ogden
    and we're not even done with the Ogden

  • 01:01:38

    yet so I would propose undo all that and
    yet so I would propose undo all that and

  • 01:01:40

    it turns out there's a way with our
    it turns out there's a way with our

  • 01:01:43

    research and also for that other
    research and also for that other

  • 01:01:44

    function re-match to tell them to match
    function re-match to tell them to match

  • 01:01:47

    your pattern case-insensitive lee so how
    your pattern case-insensitive lee so how

  • 01:01:51

    would you go if I told you is like your
    would you go if I told you is like your

  • 01:01:52

    tutor like this is possible how do you
    tutor like this is possible how do you

  • 01:01:54

    go about solving a problem like that now
    go about solving a problem like that now

  • 01:01:56

    on your own okay so I would go into
    on your own okay so I would go into

  • 01:01:59

    Google and I would say okay our
    Google and I would say okay our

  • 01:02:02

    professor Google search case-insensitive
    professor Google search case-insensitive

  • 01:02:09

    without re compilers we're not using re
    without re compilers we're not using re

  • 01:02:11

    compiles a stack that will another day
    compiles a stack that will another day

  • 01:02:13

    Stack Overflow is an awesome resources
    Stack Overflow is an awesome resources

  • 01:02:15

    and it looks like it says pass our
    and it looks like it says pass our

  • 01:02:17

    ignore case in all capital letters to
    ignore case in all capital letters to

  • 01:02:21

    the flags parameter of search match or
    the flags parameter of search match or

  • 01:02:23

    sub now what is this Flags parameter how
    sub now what is this Flags parameter how

  • 01:02:26

    do I look that up so if we go over to
    do I look that up so if we go over to

  • 01:02:29

    the documentation actually I think we
    the documentation actually I think we

  • 01:02:32

    need to have the documentation time open
    need to have the documentation time open

  • 01:02:33

    over here already scroll the very top
    over here already scroll the very top

  • 01:02:35

    Gera this type in read do that go into
    Gera this type in read do that go into

  • 01:02:39

    the module for re which is our the
    the module for re which is our the

  • 01:02:41

    module we imported and then I'm gonna
    module we imported and then I'm gonna

  • 01:02:44

    specifically I'm using the search
    specifically I'm using the search

  • 01:02:45

    function so I'm actually gonna type
    function so I'm actually gonna type

  • 01:02:48

    research and let's go to where it's
    research and let's go to where it's

  • 01:02:51

    actually defined so it looks like it's
    actually defined so it looks like it's

  • 01:02:53

    defined right here so it does say we
    defined right here so it does say we

  • 01:02:55

    have a pattern as the first parameter
    have a pattern as the first parameter

  • 01:02:57

    we've talked about this string that we
    we've talked about this string that we

  • 01:02:59

    actually want to search inside of us the
    actually want to search inside of us the

  • 01:03:01

    second parameter and then this Flags
    second parameter and then this Flags

  • 01:03:03

    equals zero
    equals zero

  • 01:03:04

    which is interesting because we're not
    which is interesting because we're not

  • 01:03:05

    passing in a number at least not that we
    passing in a number at least not that we

  • 01:03:08

    can see when we're doing it presumably
    can see when we're doing it presumably

  • 01:03:10

    you're not but the equals zero means
    you're not but the equals zero means

  • 01:03:11

    that that argument called Flags has a
    that that argument called Flags has a

  • 01:03:14

    default value of zero no matter why you
    default value of zero no matter why you

  • 01:03:16

    so you don't have to provide it and and
    so you don't have to provide it and and

  • 01:03:18

    truly underneath the hood all of the re
    truly underneath the hood all of the re

  • 01:03:20

    dot capital words that we could pass
    dot capital words that we could pass

  • 01:03:22

    into it are actually numerical and they
    into it are actually numerical and they

  • 01:03:25

    form what's called a mask or a bit mask
    form what's called a mask or a bit mask

  • 01:03:28

    a sort of a sequence of powers of two
    a sort of a sequence of powers of two

  • 01:03:31

    added together in some arbitrary way to
    added together in some arbitrary way to

  • 01:03:32

    set a series of flags and one compact
    set a series of flags and one compact

  • 01:03:34

    piece of information mm-hmm
    piece of information mm-hmm

  • 01:03:36

    and in here says where does it say
    and in here says where does it say

  • 01:03:39

    doesn't like it actually has any
    doesn't like it actually has any

  • 01:03:41

    information on flags itself not that
    information on flags itself not that

  • 01:03:43

    part of the documentation but it's in
    part of the documentation but it's in

  • 01:03:45

    there we go to Flags oh you just yep
    there we go to Flags oh you just yep

  • 01:03:48

    you hide it on the screen a moment ago I
    you hide it on the screen a moment ago I

  • 01:03:50

    did that I saw re multi-line re dot
    did that I saw re multi-line re dot

  • 01:03:55

    multi there we go oh here are the flags
    multi there we go oh here are the flags

  • 01:03:58

    okay it looks like they kind of have it
    okay it looks like they kind of have it

  • 01:04:01

    separately from everything else so these
    separately from everything else so these

  • 01:04:03

    are some of the flags so actually some
    are some of the flags so actually some

  • 01:04:06

    of these flags or some of these just
    of these flags or some of these just

  • 01:04:08

    completely other variables
    completely other variables

  • 01:04:09

    no these the capitalized ones are all
    no these the capitalized ones are all

  • 01:04:11

    flags and that I don't know how to
    flags and that I don't know how to

  • 01:04:13

    pronounce this one but the van
    pronounce this one but the van

  • 01:04:15

    it's proposed adding the flags ignore
    it's proposed adding the flags ignore

  • 01:04:18

    case and that's spot on
    case and that's spot on

  • 01:04:19

    yeah in this case are ignore case more
    yeah in this case are ignore case more

  • 01:04:22

    specifically this we wanted to import
    specifically this we wanted to import

  • 01:04:23

    star from re mmm-hmm indeed so let's go
    star from re mmm-hmm indeed so let's go

  • 01:04:27

    back to well actually I don't know if
    back to well actually I don't know if

  • 01:04:28

    you wanted to talk more about what they
    you wanted to talk more about what they

  • 01:04:30

    are but essentially ignore case there's
    are but essentially ignore case there's

  • 01:04:32

    multi line which will let you test
    multi line which will let you test

  • 01:04:34

    regular expressions at span lines and
    regular expressions at span lines and

  • 01:04:35

    then there's ignore case which will
    then there's ignore case which will

  • 01:04:37

    perform case insensitive matching
    perform case insensitive matching

  • 01:04:39

    expressions like a-to-z nice like we
    expressions like a-to-z nice like we

  • 01:04:41

    lived up so we can just disable the
    lived up so we can just disable the

  • 01:04:42

    notion of case all together without
    notion of case all together without

  • 01:04:44

    having to manually force things match
    having to manually force things match

  • 01:04:46

    lower case those actually that means
    lower case those actually that means

  • 01:04:47

    that we can get rid of this we can
    that we can get rid of this we can

  • 01:04:48

    actually just say nice Colton like that
    actually just say nice Colton like that

  • 01:04:51

    yeah and then Ogden and then as our last
    yeah and then Ogden and then as our last

  • 01:04:53

    parameter to our readout search we can
    parameter to our readout search we can

  • 01:04:55

    say re dot ignore cases yeah so it's a
    say re dot ignore cases yeah so it's a

  • 01:04:57

    third argument now explicit so that's
    third argument now explicit so that's

  • 01:04:59

    gonna tell our research don't even worry
    gonna tell our research don't even worry

  • 01:05:01

    about upper case or lower case for this
    about upper case or lower case for this

  • 01:05:02

    match exactly alright so let's go check
    match exactly alright so let's go check

  • 01:05:04

    on Colton Ogden and all caps in the
    on Colton Ogden and all caps in the

  • 01:05:06

    meantime Richard pointed out that we
    meantime Richard pointed out that we

  • 01:05:08

    didn't account for Colton Ogden one word
    didn't account for Colton Ogden one word

  • 01:05:10

    or a few other variants that's ok
    or a few other variants that's ok

  • 01:05:12

    because I was looking for a Colton than
    because I was looking for a Colton than

  • 01:05:14

    one or more spaces then in Ogden not the
    one or more spaces then in Ogden not the

  • 01:05:17

    concatenation thereof a Colt and Ogden
    concatenation thereof a Colt and Ogden

  • 01:05:18

    one word would slip under our radar yeah
    one word would slip under our radar yeah

  • 01:05:20

    oh I'm happy to see you yet again it
    oh I'm happy to see you yet again it

  • 01:05:23

    works nice this is a nice thing that are
    works nice this is a nice thing that are

  • 01:05:25

    a sort of makes life easier yeah so it's
    a sort of makes life easier yeah so it's

  • 01:05:27

    pretty intimidating honestly at first
    pretty intimidating honestly at first

  • 01:05:29

    glance but honestly do not shy away from
    glance but honestly do not shy away from

  • 01:05:31

    these they will tighten your code they
    these they will tighten your code they

  • 01:05:32

    will allow you to check for things more
    will allow you to check for things more

  • 01:05:34

    robustly we could go down even further
    robustly we could go down even further

  • 01:05:36

    here and be more precise as to what we
    here and be more precise as to what we

  • 01:05:38

    mean a last name is currently we're
    mean a last name is currently we're

  • 01:05:39

    being a little lazy and we're allowing
    being a little lazy and we're allowing

  • 01:05:41

    things like dog which is any character
    things like dog which is any character

  • 01:05:43

    so just for kicks can you go ahead and
    so just for kicks can you go ahead and

  • 01:05:45

    do Colton one two three Ogden yeah as a
    do Colton one two three Ogden yeah as a

  • 01:05:47

    test case sure you know we probably
    test case sure you know we probably

  • 01:05:49

    shouldn't tolerate this cuz at least in
    shouldn't tolerate this cuz at least in

  • 01:05:51

    the u.s. you're not gonna have like a
    the u.s. you're not gonna have like a

  • 01:05:52

    purely numeric middle name I think I
    purely numeric middle name I think I

  • 01:05:54

    don't think so that probably is not you
    don't think so that probably is not you

  • 01:05:57

    so that doesn't really meet the the test
    so that doesn't really meet the the test

  • 01:05:59

    so dot star is a little sloppy we could
    so dot star is a little sloppy we could

  • 01:06:02

    be more specific by specifying with
    be more specific by specifying with

  • 01:06:03

    character classes what letters of the
    character classes what letters of the

  • 01:06:05

    alphabet we want but we do need some
    alphabet we want but we do need some

  • 01:06:06

    punctuation right there might be hyphens
    punctuation right there might be hyphens

  • 01:06:08

    there might be quotes and other
    there might be quotes and other

  • 01:06:09

    languages there might be accented
    languages there might be accented

  • 01:06:11

    characters so we need to be a little
    characters so we need to be a little

  • 01:06:12

    respectful of the possible variation so
    respectful of the possible variation so

  • 01:06:14

    right for now I'm okay with dot star but
    right for now I'm okay with dot star but

  • 01:06:17

    you know what's kind of cool too
    you know what's kind of cool too

  • 01:06:18

    could we go ahead and could you copy
    could we go ahead and could you copy

  • 01:06:20

    your regular expression from the carrot
    your regular expression from the carrot

  • 01:06:21

    to the dollar sign and there's a bunch
    to the dollar sign and there's a bunch

  • 01:06:24

    of websites that do this can you go into
    of websites that do this can you go into

  • 01:06:25

    google now and search for like regular
    google now and search for like regular

  • 01:06:27

    expression
    expression

  • 01:06:28

    tester there's some really cool
    tester there's some really cool

  • 01:06:30

    web-based applications that help you
    web-based applications that help you

  • 01:06:31

    learn this stuff these days
    learn this stuff these days

  • 01:06:33

    let's try a regex 101 try the first one
    let's try a regex 101 try the first one

  • 01:06:37

    yeah this is one I've used before so
    yeah this is one I've used before so

  • 01:06:39

    Colton just went ahead and paste it at
    Colton just went ahead and paste it at

  • 01:06:41

    the top of the page the regular
    the top of the page the regular

  • 01:06:42

    expression that he came up with on the
    expression that he came up with on the

  • 01:06:44

    right hand side you'll see that there's
    right hand side you'll see that there's

  • 01:06:46

    this explanation which is a machine
    this explanation which is a machine

  • 01:06:47

    generated human-like summary of what it
    generated human-like summary of what it

  • 01:06:50

    is sometimes it can get a little
    is sometimes it can get a little

  • 01:06:51

    confusing but that might help you wrap
    confusing but that might help you wrap

  • 01:06:53

    your mind around it but what's cool now
    your mind around it but what's cool now

  • 01:06:54

    is go ahead and input it like a test
    is go ahead and input it like a test

  • 01:06:56

    string give us a normal Colton Ogden
    string give us a normal Colton Ogden

  • 01:06:57

    okay and you'll go ahead and see let's
    okay and you'll go ahead and see let's

  • 01:07:01

    say where's my test say oh go ahead and
    say where's my test say oh go ahead and

  • 01:07:04

    save the regular expression top left
    save the regular expression top left

  • 01:07:06

    over there oh I think that makes it oh
    over there oh I think that makes it oh

  • 01:07:09

    that will let us share it and we have to
    that will let us share it and we have to

  • 01:07:11

    do the LIA this stuff that's not
    do the LIA this stuff that's not

  • 01:07:15

    necessary because it's already there no
    necessary because it's already there no

  • 01:07:16

    don't need that and don't need the slash
    don't need that and don't need the slash

  • 01:07:18

    actually can you scroll down it might
    actually can you scroll down it might

  • 01:07:19

    just be the debacle you know what we
    just be the debacle you know what we

  • 01:07:20

    probably haven't done we probably
    probably haven't done we probably

  • 01:07:21

    haven't done ignore case brothers
    haven't done ignore case brothers

  • 01:07:24

    probably no no you are going right I
    probably no no you are going right I

  • 01:07:26

    don't know oh yes we can do that click
    don't know oh yes we can do that click

  • 01:07:28

    on the flag fires ignore you can click
    on the flag fires ignore you can click

  • 01:07:32

    right here yeah so you can just add an
    right here yeah so you can just add an

  • 01:07:34

    eye after that so in other languages you
    eye after that so in other languages you

  • 01:07:36

    actually specify these lowercase symbols
    actually specify these lowercase symbols

  • 01:07:39

    not the Python approach that makes it
    not the Python approach that makes it

  • 01:07:41

    force it to lowercase so notice this on
    force it to lowercase so notice this on

  • 01:07:44

    the right hand side here of Colton's
    the right hand side here of Colton's

  • 01:07:45

    screen you'll see that it's saying match
    screen you'll see that it's saying match

  • 01:07:47

    information and Colton Ogden is indeed a
    information and Colton Ogden is indeed a

  • 01:07:49

    first full match David J Malan is not so
    first full match David J Malan is not so

  • 01:07:52

    we're not seeing anything else do want
    we're not seeing anything else do want

  • 01:07:53

    to try a few other of your cousin's try
    to try a few other of your cousin's try

  • 01:07:59

    Colton Taylor Agha nice another full
    Colton Taylor Agha nice another full

  • 01:08:01

    match and it actually is pieced out the
    match and it actually is pieced out the

  • 01:08:03

    middle part here because it's in
    middle part here because it's in

  • 01:08:04

    parentheses it's pretty cool so if you
    parentheses it's pretty cool so if you

  • 01:08:07

    want to learn regular expressions you
    want to learn regular expressions you

  • 01:08:08

    don't have to like struggle with your
    don't have to like struggle with your

  • 01:08:09

    own code you can just kind of play with
    own code you can just kind of play with

  • 01:08:10

    it a little more visually and I
    it a little more visually and I

  • 01:08:11

    definitely use this tool in recent years
    definitely use this tool in recent years

  • 01:08:13

    especially as my regular expressions get
    especially as my regular expressions get

  • 01:08:15

    long and complicated because I want to
    long and complicated because I want to

  • 01:08:16

    vet them against sample inputs outside
    vet them against sample inputs outside

  • 01:08:19

    the context of my code okay and if we do
    the context of my code okay and if we do

  • 01:08:21

    Colton one-two-three Ogden that's a
    Colton one-two-three Ogden that's a

  • 01:08:23

    night doesn't happen well no if you
    night doesn't happen well no if you

  • 01:08:25

    scroll down oh you know why because I
    scroll down oh you know why because I

  • 01:08:26

    specified the A to Z here Oh in this
    specified the A to Z here Oh in this

  • 01:08:28

    case you did indeed yes if I go back to
    case you did indeed yes if I go back to

  • 01:08:32

    dot plus and get rid of character class
    dot plus and get rid of character class

  • 01:08:35

    as
    as

  • 01:08:36

    oh wait oh this right yep and no you
    oh wait oh this right yep and no you

  • 01:08:40

    have the duplicate space yep guys oh but
    have the duplicate space yep guys oh but

  • 01:08:43

    it looks like it's getting your name as
    it looks like it's getting your name as

  • 01:08:45

    well what did I miss up there now here
    well what did I miss up there now here

  • 01:08:48

    you have Colton spay that's weird
    you have Colton spay that's weird

  • 01:08:52

    oh you're doing multiline get rid of the
    oh you're doing multiline get rid of the

  • 01:08:54

    em from the flags that win global I'm
    em from the flags that win global I'm

  • 01:08:58

    sorry not multiline global colt and no
    sorry not multiline global colt and no

  • 01:09:05

    something's wrong can you scroll down
    something's wrong can you scroll down

  • 01:09:08

    over here on the right
    over here on the right

  • 01:09:11

    weird I think this is a bug it should be
    weird I think this is a bug it should be

  • 01:09:14

    not matching it should go ahead and
    not matching it should go ahead and

  • 01:09:15

    update the regex just for kicks even
    update the regex just for kicks even

  • 01:09:17

    though that's under save and share just
    though that's under save and share just

  • 01:09:21

    for kicks
    for kicks

  • 01:09:22

    it should not be matching multiple lines
    it should not be matching multiple lines

  • 01:09:25

    like this today yeah that's very strange
    like this today yeah that's very strange

  • 01:09:30

    no I think that's a bug in the tool oh
    no I think that's a bug in the tool oh

  • 01:09:31

    ok something's wrong well anyway ok on
    ok something's wrong well anyway ok on

  • 01:09:34

    that note well let's go ahead I think we
    that note well let's go ahead I think we

  • 01:09:36

    have a little more time to introduce one
    have a little more time to introduce one

  • 01:09:38

    or two more features right now our
    or two more features right now our

  • 01:09:40

    program is pretty static it just does
    program is pretty static it just does

  • 01:09:44

    one thing and that's it if we wanted a
    one thing and that's it if we wanted a

  • 01:09:46

    loop you know I'm kind of fond of the
    loop you know I'm kind of fond of the

  • 01:09:48

    old games like Zelda U and I've played
    old games like Zelda U and I've played

  • 01:09:49

    that on stream actually the original
    that on stream actually the original

  • 01:09:50

    Zelda and it's very common to have like
    Zelda and it's very common to have like

  • 01:09:53

    heart power HP so that you have some
    heart power HP so that you have some

  • 01:09:54

    number of hearts representing just how
    number of hearts representing just how

  • 01:09:56

    much health you have let's go ahead and
    much health you have let's go ahead and

  • 01:09:59

    start from scratch in a new file called
    start from scratch in a new file called

  • 01:10:00

    hearts a dot PI and can you just write a
    hearts a dot PI and can you just write a

  • 01:10:03

    program that asks the user for a number
    program that asks the user for a number

  • 01:10:05

    and then just print out that many hearts
    and then just print out that many hearts

  • 01:10:08

    using a Unicode character sure Unicode
    using a Unicode character sure Unicode

  • 01:10:10

    is pretty cool because you can express
    is pretty cool because you can express

  • 01:10:11

    emojis and other things these days but
    emojis and other things these days but

  • 01:10:13

    if you want to use ASCII based hearts
    if you want to use ASCII based hearts

  • 01:10:14

    with like an open bracket and a 3 that's
    with like an open bracket and a 3 that's

  • 01:10:16

    totally fine too
    totally fine too

  • 01:10:17

    but let's just go ahead and whip this up
    but let's just go ahead and whip this up

  • 01:10:18

    ask the user for number then print out
    ask the user for number then print out

  • 01:10:21

    that many hearts for him or her so I'm
    that many hearts for him or her so I'm

  • 01:10:23

    googling for heart and Unicode you know
    googling for heart and Unicode you know

  • 01:10:25

    when you get the I want to get the
    when you get the I want to get the

  • 01:10:27

    character and we'll use this one I think
    character and we'll use this one I think

  • 01:10:30

    that should work let's try that
    that should work let's try that

  • 01:10:31

    so we'll say heart char equals this
    so we'll say heart char equals this

  • 01:10:36

    little heart character knows that
    little heart character knows that

  • 01:10:37

    Unicode renders nicely in vs code and
    Unicode renders nicely in vs code and

  • 01:10:39

    we'll go ahead and now here's what I
    we'll go ahead and now here's what I

  • 01:10:42

    want to do I want to essentially take
    want to do I want to essentially take

  • 01:10:43

    the number I'm gonna get a number as
    the number I'm gonna get a number as

  • 01:10:45

    input and I want to
    input and I want to

  • 01:10:47

    we multiply that number times this heart
    we multiply that number times this heart

  • 01:10:50

    and print it out as a result hmm we're
    and print it out as a result hmm we're

  • 01:10:53

    taking a number and actually applying it
    taking a number and actually applying it

  • 01:10:54

    to a different string I like what you're
    to a different string I like what you're

  • 01:10:56

    thinking but before we go this clever
    thinking but before we go this clever

  • 01:10:57

    route could you do it a little more
    route could you do it a little more

  • 01:10:59

    familiar relief to folks using like yeah
    familiar relief to folks using like yeah

  • 01:11:01

    I'm kind of loop so I would say for I in
    I'm kind of loop so I would say for I in

  • 01:11:03

    maybe the range of numb so for every eye
    maybe the range of numb so for every eye

  • 01:11:07

    that exists in numb which is gonna be if
    that exists in numb which is gonna be if

  • 01:11:09

    it's 5 it'll be 5 it'll happen 5 times
    it's 5 it'll be 5 it'll happen 5 times

  • 01:11:11

    if it's tantamount to 10 times and then
    if it's tantamount to 10 times and then

  • 01:11:15

    let's print heart charm well we'll do
    let's print heart charm well we'll do

  • 01:11:18

    this approach for now there's a few
    this approach for now there's a few

  • 01:11:20

    issues that we have here but we'll see
    issues that we have here but we'll see

  • 01:11:22

    we'll see what happens when we run it so
    we'll see what happens when we run it so

  • 01:11:23

    I'm gonna do hearts duck pie please
    I'm gonna do hearts duck pie please

  • 01:11:27

    enter a number okay I want to see five
    enter a number okay I want to see five

  • 01:11:28

    hearts on the screen so a stir it says
    hearts on the screen so a stir it says

  • 01:11:34

    stir object cannot be interpreted as an
    stir object cannot be interpreted as an

  • 01:11:37

    integer interesting and how do you know
    integer interesting and how do you know

  • 01:11:40

    where what line is the problem so in the
    where what line is the problem so in the

  • 01:11:42

    stack trace to the trace back it kindly
    stack trace to the trace back it kindly

  • 01:11:44

    tells us that on line five on this for I
    tells us that on line five on this for I

  • 01:11:47

    in range numb it's saying that the stir
    in range numb it's saying that the stir

  • 01:11:49

    object cannot be interpreted as an
    object cannot be interpreted as an

  • 01:11:51

    integer yeah so these are the error
    integer yeah so these are the error

  • 01:11:53

    messages frankly early on they're gonna
    messages frankly early on they're gonna

  • 01:11:54

    look pretty scary but if you just start
    look pretty scary but if you just start

  • 01:11:56

    from the top especially if you get a lot
    from the top especially if you get a lot

  • 01:11:57

    of errors start with the first one look
    of errors start with the first one look

  • 01:11:59

    for the line number and then honestly
    for the line number and then honestly

  • 01:12:01

    just try to wrap your mind around what
    just try to wrap your mind around what

  • 01:12:02

    words you do understand and see if you
    words you do understand and see if you

  • 01:12:04

    can deduce then like Colton's about to
    can deduce then like Colton's about to

  • 01:12:06

    where the problem is exactly so I know
    where the problem is exactly so I know

  • 01:12:08

    that numb is what I'm using here
    that numb is what I'm using here

  • 01:12:11

    it's basically what's what I'm inputting
    it's basically what's what I'm inputting

  • 01:12:12

    at the command line and the thing about
    at the command line and the thing about

  • 01:12:14

    input is that it'll always return a
    input is that it'll always return a

  • 01:12:17

    string literally what you typed in a
    string literally what you typed in a

  • 01:12:19

    string format because they're just
    string format because they're just

  • 01:12:20

    characters on your keyboard even though
    characters on your keyboard even though

  • 01:12:21

    they happen to look like numbers exactly
    they happen to look like numbers exactly

  • 01:12:23

    now the thing is I don't want I want
    now the thing is I don't want I want

  • 01:12:27

    this to be numeric I want to be able to
    this to be numeric I want to be able to

  • 01:12:28

    iterate over this number I want to do
    iterate over this number I want to do

  • 01:12:30

    something x times and the way to do that
    something x times and the way to do that

  • 01:12:33

    is we actually have to convert that
    is we actually have to convert that

  • 01:12:34

    string into a number we have to actually
    string into a number we have to actually

  • 01:12:37

    say in Python int of all of that stuff
    say in Python int of all of that stuff

  • 01:12:41

    and what happens is that this input
    and what happens is that this input

  • 01:12:43

    value I'll please enter a number the
    value I'll please enter a number the

  • 01:12:45

    string it's actually passed to this int
    string it's actually passed to this int

  • 01:12:47

    function which just takes in a string
    function which just takes in a string

  • 01:12:49

    and returns you the number the numerical
    and returns you the number the numerical

  • 01:12:52

    version of that same string yeah so
    version of that same string yeah so

  • 01:12:54

    string 5 you get back the numbers but
    string 5 you get back the numbers but

  • 01:12:56

    number 5 the int 5 it can read into
    number 5 the int 5 it can read into

  • 01:12:58

    direct so let's try that so
    direct so let's try that so

  • 01:13:00

    heart stop hi I'm gonna say number five
    heart stop hi I'm gonna say number five

  • 01:13:02

    and okay it worries but it doesn't
    and okay it worries but it doesn't

  • 01:13:05

    really look like heart power because
    really look like heart power because

  • 01:13:07

    most games have it like horizontal yeah
    most games have it like horizontal yeah

  • 01:13:08

    we fix that I think if I was a specific
    we fix that I think if I was a specific

  • 01:13:10

    yeah so that this is a nice easy thing
    yeah so that this is a nice easy thing

  • 01:13:13

    to do in Python so the prince is a
    to do in Python so the prince is a

  • 01:13:15

    feature of the print statements a
    feature of the print statements a

  • 01:13:17

    feature
    feature

  • 01:13:17

    generally speaking or a bug-out
    generally speaking or a bug-out

  • 01:13:19

    depending on how you look at it but it's
    depending on how you look at it but it's

  • 01:13:21

    specifically a feature because often you
    specifically a feature because often you

  • 01:13:24

    want to print something on the command
    want to print something on the command

  • 01:13:25

    line but you don't want to have to
    line but you don't want to have to

  • 01:13:26

    manually specify that I want you know
    manually specify that I want you know

  • 01:13:29

    this input this output to go you know to
    this input this output to go you know to

  • 01:13:31

    do a new line every time the fact it's a
    do a new line every time the fact it's a

  • 01:13:33

    little bit tedious and the languages
    little bit tedious and the languages

  • 01:13:34

    like C and Java you have to specifically
    like C and Java you have to specifically

  • 01:13:36

    well not as much a Java but in C C++ you
    well not as much a Java but in C C++ you

  • 01:13:39

    have to specify this yourself so if I
    have to specify this yourself so if I

  • 01:13:42

    want to say just write this on the same
    want to say just write this on the same

  • 01:13:44

    line but don't do a new line print has a
    line but don't do a new line print has a

  • 01:13:47

    second parameter and this actually you
    second parameter and this actually you

  • 01:13:49

    can actually see it here written out
    can actually see it here written out

  • 01:13:50

    there's a set there's end we care about
    there's a set there's end we care about

  • 01:13:53

    n specifically notice that it has an
    n specifically notice that it has an

  • 01:13:55

    equal sign meaning that you can actually
    equal sign meaning that you can actually

  • 01:13:56

    identify that argument doesn't have to
    identify that argument doesn't have to

  • 01:13:59

    go in a specific order as long as you
    go in a specific order as long as you

  • 01:14:00

    give it a name so if I say N equals and
    give it a name so if I say N equals and

  • 01:14:03

    then just the empty string so nothing by
    then just the empty string so nothing by

  • 01:14:06

    default that's a newline character by
    default that's a newline character by

  • 01:14:08

    default into this this backslash n but I
    default into this this backslash n but I

  • 01:14:11

    don't want to do a backslash and at the
    don't want to do a backslash and at the

  • 01:14:13

    end of print I want to just nothing
    end of print I want to just nothing

  • 01:14:14

    empty string and honestly this drives me
    empty string and honestly this drives me

  • 01:14:16

    nuts about Python like it granted you
    nuts about Python like it granted you

  • 01:14:18

    don't always want a newline character
    don't always want a newline character

  • 01:14:20

    but this is so annoying to type a print
    but this is so annoying to type a print

  • 01:14:23

    line yeah print versus a print line
    line yeah print versus a print line

  • 01:14:24

    function might be might be cool yes I
    function might be might be cool yes I

  • 01:14:26

    agree
    agree

  • 01:14:27

    Java got this a little better yeah
    Java got this a little better yeah

  • 01:14:29

    written in Java you have to do system
    written in Java you have to do system

  • 01:14:31

    about out that's a bit bad but we it's
    about out that's a bit bad but we it's

  • 01:14:34

    just ugly yeah let's go ahead and run
    just ugly yeah let's go ahead and run

  • 01:14:37

    this now and let's say five okay so I
    this now and let's say five okay so I

  • 01:14:41

    have my five parts but it looks like as
    have my five parts but it looks like as

  • 01:14:44

    a byproduct of how we've coded things
    a byproduct of how we've coded things

  • 01:14:45

    now we don't go to a new line when the
    now we don't go to a new line when the

  • 01:14:47

    program is finished we just end right
    program is finished we just end right

  • 01:14:49

    after the heart well that - plus all
    after the heart well that - plus all

  • 01:14:50

    your hearts are overlapping but I think
    your hearts are overlapping but I think

  • 01:14:52

    that's a function of your using this
    that's a function of your using this

  • 01:14:53

    this unicode character in a mono spaced
    this unicode character in a mono spaced

  • 01:14:56

    environment yeah yeah it's very small
    environment yeah yeah it's very small

  • 01:14:58

    care but can we how about can we have a
    care but can we how about can we have a

  • 01:14:59

    space after every heart
    space after every heart

  • 01:15:01

    yeah and this up a little pensive lutely
    yeah and this up a little pensive lutely

  • 01:15:03

    so all we need to do is say
    so all we need to do is say

  • 01:15:06

    sepals space so separator separator and
    sepals space so separator separator and

  • 01:15:09

    then at the very end of all of this
    then at the very end of all of this

  • 01:15:11

    stuff at the very end I'm just gonna do
    stuff at the very end I'm just gonna do

  • 01:15:13

    a print okay outside of the for loop
    a print okay outside of the for loop

  • 01:15:14

    outside of the for loop because
    outside of the for loop because

  • 01:15:16

    otherwise we'll get the same behavior
    otherwise we'll get the same behavior

  • 01:15:17

    that we got before which was that it
    that we got before which was that it

  • 01:15:18

    printed every it printed everything on a
    printed every it printed everything on a

  • 01:15:21

    new line which is nice not the behavior
    new line which is nice not the behavior

  • 01:15:23

    we were seeking jenkins from russia
    we were seeking jenkins from russia

  • 01:15:24

    hello from cambridge this is not PyCharm
    hello from cambridge this is not PyCharm

  • 01:15:26

    this is just the s code a free text
    this is just the s code a free text

  • 01:15:29

    editor so if we if we enter a number
    editor so if we if we enter a number

  • 01:15:30

    five oh and it turns out that that
    five oh and it turns out that that

  • 01:15:32

    didn't work is maybe sep not what I'm
    didn't work is maybe sep not what I'm

  • 01:15:34

    thinking it is no it is I think this is
    thinking it is no it is I think this is

  • 01:15:36

    an issue of ask you know what let's go
    an issue of ask you know what let's go

  • 01:15:38

    ahead and instead of printing out the
    ahead and instead of printing out the

  • 01:15:39

    heart char that you have can you change
    heart char that you have can you change

  • 01:15:41

    it to an angle bracket in a three sure
    it to an angle bracket in a three sure

  • 01:15:43

    let's do it old-school style let's do it
    let's do it old-school style let's do it

  • 01:15:45

    that way please enter number five still
    that way please enter number five still

  • 01:15:50

    didn't print the space oh you know what
    didn't print the space oh you know what

  • 01:15:52

    because you're only printing one piece
    because you're only printing one piece

  • 01:15:54

    at a time
    at a time

  • 01:15:54

    so you actually do here what we can
    so you actually do here what we can

  • 01:15:59

    change in the ending to be a space will
    change in the ending to be a space will

  • 01:16:00

    do this and then we'll go and then we'll
    do this and then we'll go and then we'll

  • 01:16:05

    bring back our our heart character I'll
    bring back our our heart character I'll

  • 01:16:07

    see if that actually fixes it so we'll
    see if that actually fixes it so we'll

  • 01:16:09

    copy that separator would work if you
    copy that separator would work if you

  • 01:16:11

    were passing in multiple inputs like a
    were passing in multiple inputs like a

  • 01:16:12

    list that needs to be printed on oh I
    list that needs to be printed on oh I

  • 01:16:14

    say okay well then we can there is a way
    say okay well then we can there is a way

  • 01:16:16

    we could do that now let's go ahead and
    we could do that now let's go ahead and

  • 01:16:19

    we'll type we'll do this again enter
    we'll type we'll do this again enter

  • 01:16:21

    five and then we have nice long I should
    five and then we have nice long I should

  • 01:16:23

    answer okay the five hearts okay very
    answer okay the five hearts okay very

  • 01:16:25

    nice now you started I think to go down
    nice now you started I think to go down

  • 01:16:27

    a pretty sophisticated road that might
    a pretty sophisticated road that might

  • 01:16:29

    be unfamiliar to a lot of folks do you
    be unfamiliar to a lot of folks do you

  • 01:16:30

    absolutely need to the for loop like
    absolutely need to the for loop like

  • 01:16:32

    this or is there a more pythonic way to
    this or is there a more pythonic way to

  • 01:16:34

    do there is a more pythonic way and this
    do there is a more pythonic way and this

  • 01:16:36

    is something that's more specific to the
    is something that's more specific to the

  • 01:16:38

    way python handles strings python is
    way python handles strings python is

  • 01:16:40

    actually overloaded the multiplication
    actually overloaded the multiplication

  • 01:16:43

    operator so in the same way that it's
    operator so in the same way that it's

  • 01:16:45

    overloaded the plus sign to allow you to
    overloaded the plus sign to allow you to

  • 01:16:47

    add two strings together end to end it's
    add two strings together end to end it's

  • 01:16:50

    actually giving you the ability to use
    actually giving you the ability to use

  • 01:16:52

    the multiplication sign the asterisk
    the multiplication sign the asterisk

  • 01:16:54

    which we haven't actually looked at yet
    which we haven't actually looked at yet

  • 01:16:55

    to allow string multiplication now
    to allow string multiplication now

  • 01:16:57

    normally it's not a thing in the real
    normally it's not a thing in the real

  • 01:16:59

    world but in Python but that essentially
    world but in Python but that essentially

  • 01:17:01

    does is it just outputs that string x
    does is it just outputs that string x

  • 01:17:03

    times depending on what the multiplier
    times depending on what the multiplier

  • 01:17:05

    is correct so if we say let's say
    is correct so if we say let's say

  • 01:17:08

    instead of what we did before let's
    instead of what we did before let's

  • 01:17:10

    actually print heart char x now
    actually print heart char x now

  • 01:17:17

    so we're actually multiplying this heart
    so we're actually multiplying this heart

  • 01:17:20

    string by the gnome that we've converted
    string by the gnome that we've converted

  • 01:17:22

    into an integer up top nice we run this
    into an integer up top nice we run this

  • 01:17:24

    and enter 5 and we get the same behavior
    and enter 5 and we get the same behavior

  • 01:17:28

    unfortunately that we had before
    unfortunately that we had before

  • 01:17:30

    now there is another way we can do this
    now there is another way we can do this

  • 01:17:32

    if we wanted to use what's called a list
    if we wanted to use what's called a list

  • 01:17:35

    comprehension if you wanted to talk
    comprehension if you wanted to talk

  • 01:17:37

    about if we want to bring that up what's
    about if we want to bring that up what's

  • 01:17:39

    up what are we gonna use it for and we
    up what are we gonna use it for and we

  • 01:17:40

    would actually turn this into a list of
    would actually turn this into a list of

  • 01:17:42

    five of these then we can use set with
    five of these then we can use set with

  • 01:17:44

    space yeah you know you're not wrong
    space yeah you know you're not wrong

  • 01:17:46

    that that would actually help here so
    that that would actually help here so

  • 01:17:48

    yeah let's go for it let's all write a
    yeah let's go for it let's all write a

  • 01:17:50

    little teaser for what more you can do
    little teaser for what more you can do

  • 01:17:51

    with Python
    with Python

  • 01:17:52

    so we'll say we'll do this thing we'll
    so we'll say we'll do this thing we'll

  • 01:17:53

    say heart first of all I'm not going to
    say heart first of all I'm not going to

  • 01:17:55

    call it heart char anymore because
    call it heart char anymore because

  • 01:17:57

    that's not accurate we're gonna say
    that's not accurate we're gonna say

  • 01:17:58

    hearts equals and then this is gonna be
    hearts equals and then this is gonna be

  • 01:18:01

    a little bit of odd syntax so it's gonna
    a little bit of odd syntax so it's gonna

  • 01:18:03

    look similar to lists that we've looked
    look similar to lists that we've looked

  • 01:18:04

    at before but I'm gonna say for I in
    at before but I'm gonna say for I in

  • 01:18:08

    numb like Vince so hearts equals the
    numb like Vince so hearts equals the

  • 01:18:11

    unicode heart for every eye in numb so
    unicode heart for every eye in numb so

  • 01:18:16

    these brackets here they're creating a
    these brackets here they're creating a

  • 01:18:18

    list just like we did before but we're
    list just like we did before but we're

  • 01:18:20

    using an expression to actually create a
    using an expression to actually create a

  • 01:18:22

    list programmatically we're saying for
    list programmatically we're saying for

  • 01:18:24

    every eye and numb so from 0 it's 2 of 4
    every eye and numb so from 0 it's 2 of 4

  • 01:18:27

    in this case 0 to 5 we're going to add
    in this case 0 to 5 we're going to add

  • 01:18:30

    this the heart character okay so at the
    this the heart character okay so at the

  • 01:18:33

    end of all and at the end of this line
    end of all and at the end of this line

  • 01:18:35

    here essentially gonna have this we're
    here essentially gonna have this we're

  • 01:18:38

    gonna have this in a list it's
    gonna have this in a list it's

  • 01:18:42

    essentially the same a same exact thing
    essentially the same a same exact thing

  • 01:18:44

    very nice and so now what we can do is
    very nice and so now what we can do is

  • 01:18:46

    we can say print hearts set equals the
    we can say print hearts set equals the

  • 01:18:51

    space character because we're printing a
    space character because we're printing a

  • 01:18:53

    list of things and actually I'm I think
    list of things and actually I'm I think

  • 01:18:56

    you're gonna print the list but let's go
    you're gonna print the list but let's go

  • 01:18:57

    ahead and see what you've done I think
    ahead and see what you've done I think

  • 01:18:58

    we're gonna print the list actually so I
    we're gonna print the list actually so I

  • 01:19:00

    need to I need to refresh my mind on how
    need to I need to refresh my mind on how

  • 01:19:01

    set actually works but I'll do 5 and
    set actually works but I'll do 5 and

  • 01:19:04

    then a int object is not iterable oh I
    then a int object is not iterable oh I

  • 01:19:07

    messed that up so you can't actually
    messed that up so you can't actually

  • 01:19:09

    iterate on the number itself you
    iterate on the number itself you

  • 01:19:12

    actually have to call range of them so
    actually have to call range of them so

  • 01:19:15

    range gives you back the number 0 up to
    range gives you back the number 0 up to

  • 01:19:18

    5 or s case if you type in yeah
    5 or s case if you type in yeah

  • 01:19:21

    it's a it's what's called a generator in
    it's a it's what's called a generator in

  • 01:19:23

    that it gives you values every time you
    that it gives you values every time you

  • 01:19:25

    call it over and over again but that's
    call it over and over again but that's

  • 01:19:27

    beyond the scope I think
    beyond the scope I think

  • 01:19:28

    of this tutorial nice so now you have a
    of this tutorial nice so now you have a

  • 01:19:31

    list a data type containing five hearts
    list a data type containing five hearts

  • 01:19:34

    we did so what can we do with this now
    we did so what can we do with this now

  • 01:19:35

    because you're printing it out but we
    because you're printing it out but we

  • 01:19:36

    don't want the square brackets or the
    don't want the square brackets or the

  • 01:19:38

    quotes or anything like that so I need
    quotes or anything like that so I need

  • 01:19:39

    to look and see how step actually works
    to look and see how step actually works

  • 01:19:41

    so Python print set I don't use it too
    so Python print set I don't use it too

  • 01:19:44

    often set parameter in print
    often set parameter in print

  • 01:19:47

    oh I see so if you're actually if you
    oh I see so if you're actually if you

  • 01:19:50

    actually pass it multiple things in the
    actually pass it multiple things in the

  • 01:19:52

    in the parentheses now is there a way to
    in the parentheses now is there a way to

  • 01:19:56

    unpack I think there is and actually
    unpack I think there is and actually

  • 01:19:58

    think I might know it offhand if we were
    think I might know it offhand if we were

  • 01:20:00

    to say print hearts star except those
    to say print hearts star except those

  • 01:20:03

    that not right or is it star hearts
    that not right or is it star hearts

  • 01:20:05

    we're not allowed to do that I think it
    we're not allowed to do that I think it

  • 01:20:07

    starts so first of all let's test to
    starts so first of all let's test to

  • 01:20:10

    make sure that works before I before I
    make sure that works before I before I

  • 01:20:12

    okay it does work and then we'll explain
    okay it does work and then we'll explain

  • 01:20:14

    why it works so this star operator is
    why it works so this star operator is

  • 01:20:18

    not multiplication in this case this is
    not multiplication in this case this is

  • 01:20:21

    actually an unpacking operator so if you
    actually an unpacking operator so if you

  • 01:20:23

    have a data structure in this case the
    have a data structure in this case the

  • 01:20:25

    list but you want to pass every element
    list but you want to pass every element

  • 01:20:28

    of that data structure into a function
    of that data structure into a function

  • 01:20:30

    like you were literally calling print of
    like you were literally calling print of

  • 01:20:33

    this five times like this whoops I
    this five times like this whoops I

  • 01:20:38

    messed that up a little bit but if we
    messed that up a little bit but if we

  • 01:20:40

    were doing essentially that without the
    were doing essentially that without the

  • 01:20:41

    syntax error we we can't do that by
    syntax error we we can't do that by

  • 01:20:44

    passing in just the list object because
    passing in just the list object because

  • 01:20:46

    that's just one argument but if you want
    that's just one argument but if you want

  • 01:20:48

    to unpack all of the data within the
    to unpack all of the data within the

  • 01:20:50

    list you can explode it in a comma
    list you can explode it in a comma

  • 01:20:53

    separated list about it I think that's
    separated list about it I think that's

  • 01:20:54

    actually the term I think it's called
    actually the term I think it's called

  • 01:20:55

    the explode operator or something
    the explode operator or something

  • 01:20:56

    something like that and you can also or
    something like that and you can also or

  • 01:20:59

    splaying in JavaScript these days so if
    splaying in JavaScript these days so if

  • 01:21:01

    you go to hearts - can I propose one
    you go to hearts - can I propose one

  • 01:21:03

    other approach yeah
    other approach yeah

  • 01:21:04

    if hearts on line five is a list you can
    if hearts on line five is a list you can

  • 01:21:07

    also do this if you know in advance how
    also do this if you know in advance how

  • 01:21:08

    you want to separate the elements of any
    you want to separate the elements of any

  • 01:21:10

    list there you go you can go ahead and
    list there you go you can go ahead and

  • 01:21:12

    do quote space unquote right dot join
    do quote space unquote right dot join

  • 01:21:16

    but give me a space between the quotes
    but give me a space between the quotes

  • 01:21:18

    alright because we're doing it on space
    alright because we're doing it on space

  • 01:21:20

    as one of that space separate join the
    as one of that space separate join the

  • 01:21:21

    hearts and get rid of the separator
    hearts and get rid of the separator

  • 01:21:23

    altogether so now we're not asking for
    altogether so now we're not asking for

  • 01:21:24

    prints help instead we're gonna pass to
    prints help instead we're gonna pass to

  • 01:21:26

    print the result of joining of that list
    print the result of joining of that list

  • 01:21:28

    of heart with one space in between and
    of heart with one space in between and

  • 01:21:31

    this way - nicely enough you don't end
    this way - nicely enough you don't end

  • 01:21:33

    up for instance with an accidental space
    up for instance with an accidental space

  • 01:21:34

    at the very end that's there even if you
    at the very end that's there even if you

  • 01:21:36

    can't see it right and this
    can't see it right and this

  • 01:21:38

    this approach is cleaner I think more of
    this approach is cleaner I think more of

  • 01:21:39

    a pythonic way to do it so we'll do five
    a pythonic way to do it so we'll do five

  • 01:21:42

    and then we can lie exact same behavior
    and then we can lie exact same behavior

  • 01:21:43

    but we've we've actually made it a
    but we've we've actually made it a

  • 01:21:45

    little bit I think clearer we save some
    little bit I think clearer we save some

  • 01:21:47

    space in our code yeah absolutely it's a
    space in our code yeah absolutely it's a

  • 01:21:49

    pretty cool so I think we're we're just
    pretty cool so I think we're we're just

  • 01:21:51

    about at the end of the hour here and so
    about at the end of the hour here and so

  • 01:21:54

    what were some of the takeaways we hope
    what were some of the takeaways we hope

  • 01:21:55

    so one all you need for python is a text
    so one all you need for python is a text

  • 01:21:58

    edit or whether it's the one Colton is
    edit or whether it's the one Colton is

  • 01:21:59

    using here or really any other and you
    using here or really any other and you

  • 01:22:01

    need Python itself preferably version
    need Python itself preferably version

  • 01:22:03

    three which you can download for free
    three which you can download for free

  • 01:22:04

    the Python org and then after that
    the Python org and then after that

  • 01:22:06

    notice that if you've programmed before
    notice that if you've programmed before

  • 01:22:08

    there's a lot of familiar constructs
    there's a lot of familiar constructs

  • 01:22:09

    you've got functions and you've got
    you've got functions and you've got

  • 01:22:11

    variables and assignment and conditions
    variables and assignment and conditions

  • 01:22:13

    and loops but then you have these
    and loops but then you have these

  • 01:22:14

    fancier features like regular
    fancier features like regular

  • 01:22:15

    expressions so powerful not only in
    expressions so powerful not only in

  • 01:22:18

    Python but other languages but also some
    Python but other languages but also some

  • 01:22:19

    of these syntactic tricks like list
    of these syntactic tricks like list

  • 01:22:22

    comprehensions as colton notes and a lot
    comprehensions as colton notes and a lot

  • 01:22:24

    of the object-oriented features that
    of the object-oriented features that

  • 01:22:26

    we've also touched upon over time so
    we've also touched upon over time so

  • 01:22:28

    honestly I think personally I would say
    honestly I think personally I would say

  • 01:22:29

    the biggest takeaway for today should be
    the biggest takeaway for today should be

  • 01:22:30

    please do not be afraid of regular
    please do not be afraid of regular

  • 01:22:33

    expressions they can absolutely get
    expressions they can absolutely get

  • 01:22:34

    scary but they don't have to start that
    scary but they don't have to start that

  • 01:22:36

    way and so if you really do take baby
    way and so if you really do take baby

  • 01:22:38

    steps and just solve part of your Colton
    steps and just solve part of your Colton

  • 01:22:40

    problem then more of your ogden problem
    problem then more of your ogden problem

  • 01:22:42

    and then take care of everything in
    and then take care of everything in

  • 01:22:43

    between you really can bootstrap
    between you really can bootstrap

  • 01:22:44

    yourself so to speak to a really
    yourself so to speak to a really

  • 01:22:46

    impressive solution that you're proud of
    impressive solution that you're proud of

  • 01:22:48

    without having to know what their answer
    without having to know what their answer

  • 01:22:50

    is right off the top of your head we
    is right off the top of your head we

  • 01:22:51

    have a lot of Colton Ogden problems we
    have a lot of Colton Ogden problems we

  • 01:22:53

    do we are so unhappy to see so many
    do we are so unhappy to see so many

  • 01:22:55

    Colton Ogden's today as well as in the
    Colton Ogden's today as well as in the

  • 01:22:57

    chat I saw Colton's hair yeah one day
    chat I saw Colton's hair yeah one day

  • 01:22:59

    the pointers too many thanks everybody
    the pointers too many thanks everybody

  • 01:23:02

    for tuning in we this is this is pretty
    for tuning in we this is this is pretty

  • 01:23:04

    fun maybe in the future if we can find
    fun maybe in the future if we can find

  • 01:23:06

    the time we'll do a part two because
    the time we'll do a part two because

  • 01:23:07

    there's a million different things we
    there's a million different things we

  • 01:23:09

    could talk about but hopefully this at
    could talk about but hopefully this at

  • 01:23:11

    least wet your appetite for what Python
    least wet your appetite for what Python

  • 01:23:12

    is capable of doing very easily very
    is capable of doing very easily very

  • 01:23:14

    cleanly especially if you come from a
    cleanly especially if you come from a

  • 01:23:15

    background programming and something
    background programming and something

  • 01:23:16

    like C or Java where things are a little
    like C or Java where things are a little

  • 01:23:18

    bit more less managed for you absolutely
    bit more less managed for you absolutely

  • 01:23:21

    so feel free to tinker and let us know
    so feel free to tinker and let us know

  • 01:23:23

    via various cs50 various channels if you
    via various cs50 various channels if you

  • 01:23:25

    have any questions but looking forward
    have any questions but looking forward

  • 01:23:26

    to seeing everyone again and have a
    to seeing everyone again and have a

  • 01:23:27

    great weekend youtube.com slash cs50
    great weekend youtube.com slash cs50

  • 01:23:30

    facebook.com slash news 50 check out our
    facebook.com slash news 50 check out our

  • 01:23:32

    content cool am on the note have a great
    content cool am on the note have a great

  • 01:23:35

    weekend we will see you actually I won't
    weekend we will see you actually I won't

  • 01:23:37

    be here next week I'm going to Japan but
    be here next week I'm going to Japan but

  • 01:23:40

    the week after that I will see all of
    the week after that I will see all of

  • 01:23:42

    you so in the meantime you know enjoy
    you so in the meantime you know enjoy

  • 01:23:45

    enjoy your weekend dude time
    enjoy your weekend dude time

  • 01:23:47

    break from Colton Ogden because you know
    break from Colton Ogden because you know

  • 01:23:48

    way we that unhappy face every bit a
    way we that unhappy face every bit a

  • 01:23:50

    little bit of that is too much but in
    little bit of that is too much but in

  • 01:23:53

    the meantime I'll miss all of you and
    the meantime I'll miss all of you and

  • 01:23:54

    we'll see you in just a couple of weeks
    we'll see you in just a couple of weeks

  • 01:23:57

    so until then take care
    so until then take care

All idiom
this is
//

idiom

Used to quote, paraphrase, or mimic the words of someone else, especially in a mocking or derisive manner.

PYTHON TUTORIAL! - CS50 Live, EP. 63

21,078 views

Video Language:

  • English

Caption Language:

  • English (en)

Accent:

  • English (US)

Speech Time:

99%
  • 1:23:35 / 1:24:00

Speech Rate:

  • 212 wpm - Fast

Category:

  • Education

Intro:

all right hello world this is cs50 live. my name is Colton Ogden today we're. joined by the man himself. David Malin hello everyone good to see. everyone on stream and not just in the. chat today we are doing something pretty. cool today pretty fun we're doing a from. scratch of Python tutorial and my. understanding is that you've actually. brought some questions and topics. problem challenges that I haven't seen. that we're gonna implement and I'm gonna. sort of be a proxy to somebody who maybe. is learning for the first time indeed so. I'm gonna pretty much assume that Colton. may or may not actually know Python and. so along the way we'll try to solve some. problems actively by a coding we'll pull. things up by Google or Stack Overflow as. we go and frankly try to approximate the.

Video Vocabulary

noun verb

tool, utensil, or other piece of equipment. To start to do something you plan to do.

/ˈCHalənj/

noun other verb

invitation to compete/fight. Questions to determine correctness of some things. To formally invite someone to compete at something.

/ˈak(t)SH(o͞o)əlē/

adverb

as truth or facts.

/ˈkwesCH(ə)n/

noun other verb

sentence worded or expressed so as to elicit information. Issues or problems you are dealing with. ask someone questions.

/ˈrīdiNG/

noun other verb

activity or skill of writing. To invent or create a computer program. To compose letters and words on paper or a screen.

/skraCH/

adjective noun verb

assembled or made from whatever is available, and so unlikely to be of highest quality. Action of rubbing your skin when itchy. To make a small cut or mark on a surface.

/ˌəndərˈstandiNG/

adjective noun verb

sympathetically aware of other people's feelings. ability to understand something. To know the meaning of language, what someone says.

/ˈevrēˌwən/

pronoun

every person.

/ˈpräbləm/

adjective noun

Causing trouble. Question to show understanding of a math concept.

/t(y)o͞oˈtôrēəl/

adjective noun

relating to tutor or tutor's tuition. A lesson given to a small group.

/ˈfraNGklē/

adverb

Speaking honestly and directly.

/ˈlərniNG/

noun verb

acquisition of knowledge or skills through study. To get knowledge or skills by study or experience.

/ˌikˈspirēəns/

noun verb

An event at which you learned something. To gain knowledge by doing things.

/ˈaktivlē/

adverb

Doing things to achieve a specific goal.

adjective verb

close to actual, but not completely accurate or exact. To be similar to, but not exactly the same.