Python for Absolute Beginners Transcripts
Chapter: The big ideas of software development
Lecture: Big idea: How does code execute?

Login or purchase this course to watch this video and the rest of the course contents.
0:00 How does code execute? Well, we're going to focus of course on Python code and one of the things I have to do a lot I mean in a whole lot
0:09 more than is reasonable I think is I need to take proper titles and convert these to either file names or the folder names
0:17 as I'm developing these courses working on my podcast and so on. And that can be a little bit error prone. For example, if I want to take the phrase
0:25 the title here How does a code execute? That is not a valid thing I can put as a url because the question mark means something
0:32 and these spaces aren't created and the capital H is kind of a problem. So a reasonable thing to do would be to lower case everything
0:39 drop the punctuation put dashes in between it that will work for file systems stuff like folders or even URLs as you might guest by the name.
0:46 Because I want to make this something I want to think about make it completely obvious and re-usable and maybe even compose-able
0:53 I mixed it in with other scripts or something like that. I wrote this program called urlfy and the way we run it is we say Python space urlfy.py
1:05 and this is going to take this source code the Python code that I wrote in a file and then execute it.
1:11 Notice we have in the clipboard the title basically How does this code excute or how this code execute. When I run it, a little title thing
1:18 urlfy dash, dash, dash, dash comes out and says we're reading data from the clipboard so the program uses a library to access
1:25 the macOS clipboarder, really in a clipboard and then it's just give you a null. Okay, the thing we're going to turn into url format
1:32 is how does code execute question mark and then it coverts it how to how doe code execute with dashes and lower case just like I described.
1:38 And because that was so fun and you always want to have a little break and a shoot day let's shoot out a few emojis
1:43 three stars and like a little triple star farther in the distance. And it's in the final message to the user copied to the clipboard
1:50 and put a little emoji of a clipboarder something like that so we can just type this line and then whatever is in the clipboard
1:56 is now transformed into this form that we can paste somewhere else. So this is great. This is super useful and this is actually something
2:03 that is a great place to start when you're learning Python. 'Cause this little tiny utilities like you know what I do all day? I've take this words
2:11 and I turned them into subs that is valid to put in into folder names or file names. Well, if you want you can write a little program
2:18 so probably 15 lines to Python code and it does this automatically never making an error. Super, super handy. So the big question is
2:27 what is actually happening here? Sure, once we understand the Python codings they will run it at this line and this line and this line
2:34 but there is actually a whole lot on going on. Right, there's RAM and CPU instruction and all kind of interesting stuff happening.
2:42 So in this short section we're going to focus on what happens when we give Python some source codes and it actually runs it as a program.


Talk Python's Mastodon Michael Kennedy's Mastodon