
The Art of Network Engineering
The Art of Network Engineering blends technical insight with real-world stories from engineers, innovators, and IT pros. From data centers on cruise ships to rockets in space, we explore the people, tools, and trends shaping the future of networking, while keeping it authentic, practical, and human.
We tell the human stories behind network engineering so every engineer feels seen, supported, and inspired to grow in a rapidly changing industry.
For more information, check out https://linktr.ee/artofneteng
The Art of Network Engineering
Python Party - Episode 1
We’re kicking off a brand-new “Python Study Sessions” series—learn right alongside host Andy Lapteff as he starts from absolute basics and builds momentum one concept at a time. In this first session, Andy walks through the installation of Python, setting up VS Code, running “Hello, world,” and getting comfortable with the Python REPL. Then we dive into fundamentals you’ll use everywhere: variables, print(), syntax highlighting, saving/running files, common traceback errors, and simple debugging in VS Code. This series is inspired by learning in public—join the community, ask questions, and study together as we work through Python Crash Course (3rd ed.). If you liked our recent, more technical BGP episode, you’ll love where this is headed.
What you’ll learn
- Installing Python 3 and launching the interpreter
- Writing and running your first script in VS Code
- Variables 101: assignment, reassignment, and printing values
- Reading tracebacks and fixing name/syntax errors
- Beginner mindset tips for sticking with code
We’ll stream future sessions and continue to publish the audio here. Want to follow along live, ask questions, or share your wins? Watch for stream announcements on our socials: @ArtOfNetEng.
If this format helps you, tell us—rate the show, leave a comment, or share with a friend who’s been meaning to learn Python. Your feedback decides if we keep this series going.
Subscribe to our YouTube channel and click the notification icon to get notified of our free Python Party Livestreams, where we learn Python fundamentals together: https://www.youtube.com/@artofneteng
https://www.youtube.com/@erika_thedev
FREE Learn to Code for network engineers course:
https://youtube.com/playlist?list=PLvfm4aNXLC8wiJs-YGVQXUwukv06z5NJS&si=EqTVV_57fkfHCpP_
https://www.youtube.com/@Tracketpacer
Study Streams:
https://youtube.com/playlist?list=PLj0DbZdkhZoc8t3X98tjB4lfKMRgq03LI&si=bJ9t1tM_3cmJwesR
Support the show:
https://www.buzzsprout.com/2127872/support
This episode has been sponsored by Meter.
Go to meter.com/aone to book a demo now!
You can support the show at https://www.buzzsprout.com/2127872/support or from the "Support The Show" link at https://linktr.ee/artofneteng.
Thanks for listening and for your continued support :)
Find everything AONE right here: https://linktr.ee/artofneteng
00:00
This is the art of network engineering, where technology meets the human side of IT. Whether you're scaling networks, solving problems, or shaping your career, we've got the insights, stories, and tips to keep you ahead in the ever evolving world of networking. Welcome to the Art of Network Engineering podcast. My name is Andy Lapteff, and this is the launch of a new series, a Python study session series that we're going to release and see if you like it. I streamed out a Python study session.
00:29
recently had some people hop in. It was good interaction. We helped each other through it. And what I'm going to do is work my way through this book, Python Crash Course Third Edition by Eric Mathis. I am going to be live streaming these out for a little bit of community involvement, but I thought, you know what, if I'm walking through a brand new person trying to learn Python, which I am, and I can share this with our community as a podcast, there might be some value there for you. So this is an attempt to try something very different.
00:56
I don't really know how it's going to translate as a podcast. I think it's going to be helpful. And if you want to join me on this journey and learn Python with me, this is episode one of that journey. This will go out as an audio version of the podcast, as well as on our YouTube channel, Art of NetEng. So if you enjoy this episode, this type of content, please let us know. And we will continue to bring you more and more technical content. We just released a BGP episode, which got a lot of attention.
01:25
I think because it was more technical in nature. So leaning a little more towards the technical this year in 2025. I'm enjoying it. Jeff is enjoying it. We brought in our friend Kevin, who's also enjoying making this kind of content. So this is just me studying Python, but if you enjoy it and you like it, please let us know. All right. On with the show. What I'm trying to do is study some Python. I am very new to Python. I just bought a book. I did a thing and I'm like, you know what? In, uh,
01:54
in Lexi Cooper in track at Pacer form style inspired by Lexi. I am going to study Python. I really um liked watching Lexi study publicly and I enjoyed it and I learned a lot and I'm try to do that here. I am going to get started here. So I am studying Python crash course, third edition. I do not particularly love programming. uh
02:23
But here I am. It's important. um I need to learn some automation. I actually want to learn it. I needed to learn it for a long time and didn't. But now I have um an actual want. I'm sorry, an actual, yes, an actual want, an actual desire to learn some Python. I want to be able to see a Python script and understand what's happening. And I am not there. So this book is pretty awesome. It starts out super simple. um Just looking at
02:51
contents here, this is kind of where I start to get lost as I'm studying. Start learning what a variable is, data types, lists. If makes sense to me, like if thens. I took an intro to logic class in college and there was a lot of like if then logic. I kind of get that dictionaries, loops, functions. What generally happens to me is I learned like three or four of these concepts and then like, I don't know, a couple of days or weeks later, it'll get brought up again. And I'm like, wait, is that a list? Is that a dictionary?
03:21
Um, so keeping this all straight in my head is generally the challenge. Um, I do want to go through Erica Dietrich's course, which I haven't yet, but, uh, Erica, the dev has an amazing, uh, starter course that she put out. Um, I believe on her YouTube channel had Erica, the dev, which, um, is a very good primer getting in the right mindset. Um, and she has said before that the industry does a really poor job at teaching programming. So, um,
03:50
That made me feel kind of a little better that it wasn't just me. So, um, I guess I'm just going to get to the first chapter here and get started. Um, if anybody's watching and you want to follow along great, we can do this together. Um, if you have any questions or anything, throw in the chat. Uh, and I'm basically just going to study. I'm going to live stream it intro.
04:16
All right, so who is this book for? Bring me up to speed and Python as quickly as possible. Cool. I'm into that. I have never programmed before, which is what this paragraph is talking about. I would like to learn the basics of programming. It says quickly. I mean, I'm okay taking my time. I'm not in a huge rush to learn programming, but also there's a lot of other cool stuff that I want to learn around the AI, LLM, machine learning stuff. And I kind of feel like understanding basic
04:46
programming is kind of a prereq to getting to all that other AI LLM stuff that is taking over our world, our lives, our careers. So um I'm not learning Python to become Mr. AI. I'm learning Python because I'm genuinely curious to learn how this stuff works. And I finally think I can do it, or before I didn't. anyway, the beginning of this book is kind of describing me, someone who doesn't know Python, someone who's not proficient in it, has it done it before.
05:16
I am intimidated by programming, but I'm working on that and getting over it. A lot of this just goes through, this is what we're going to do. There's going to be exercises, blah, blah, typical kind of programming book. um This gentleman who wrote this book, I think there's like a bio in here of him, but I think he's like a school teacher. He's been doing it for decades. He's thought of moving off Python before, but it's just such a great uh program. It's versatile, it's powerful, and it's one of the easier ones to learn, I think.
05:45
which I am into, so um I am glad that he stuck with Python. All right, let's get to some actual stuff. All right, so getting started, we're gonna run our first program, Hello World, that seems to be a tradition in programming. Apparently I have to scroll slower so it doesn't jump like that. We're gonna check if we have Python installed on our computer. If not, we'll install it. We'll install Text Editor. um
06:16
think we're going to use Microsoft Visual Studio, which is an IDE. What does IDE stand for? It'll probably tell us. I know some of the terms. I've been trying to learn coding. I've struggled with it for a really long time. So this is going to be very, very basic, very, very beginner friendly, because that is where I am in my programming journey. Setting up your environment. All right, so next. Every programming language evolves. Ba-ba-ba, de-de-de, developers. All right, so there's different versions of Python.
06:45
Um, they want us to know about, think we have to use a three, nine or later, um, in this book, because I guess when they update Python, um, things change and then the code doesn't work. So that seems to be a thing. Throughout this book, you'll see code snippets like this. Okay. Great. Three angle bracket prompts, which refer to as a Python prompt. So I guess right here, you're telling us that means that we're in a Python prompt. You should be using the terminal window. So let me bring up a terminal.
07:16
environment set up here. All right. So here is my terminal. Let me see if I can blow that up a little bit. So they're going to tell us, I think shortly, how to do this. But I believe from memory, if you're in your terminal and you just type Python three, whoops, that is not it. Maybe it's Python no space three. Aha. All I got lucky there. So this is what they're referring to in the textbook. These three
07:46
What do they call them? Angle brackets, prompts? I don't know, but this is the Python prompt. So this tells us that we are um in the Python interpreter. Do do do do. Three angle brackets prompt, Python prompt, indicator in the terminal window, bold text is what you should type. All right, so the bold text is what we should type. Just kind of letting us know how the book is laid out. um I know this is boring. I know I should probably skip this, but this is the kind of stuff that if I don't pay attention to up front, I'll get lost later.
08:15
like what's happening, I don't understand. just hang with me as I go through this. So the bold stuff is what we type in. These three guys tell us we're in the interpreter and the terminal. We're to write most of our code in a text editor, which I believe is the ID, not the Python interpreter, not the terminal. But they're just telling us that there's a difference between it. I'll use the text editor, create a program, and then we'll run the program. All right, about the VS code editor, this is important.
08:44
Let me put this down here. VS Code is a powerful, professional, quality text editor that's free and beginner-friendly. VS Code is great for both simple and complex projects. I'm going to try to skim through this because there's a lot of chapters, a lot of words, and it'll take forever. So in the interest of time, um the reason I like VS Code is there's a Python plugin extension, whatever it's called, that we'll install. And it gives you a nice color code thing that
09:14
tells you like your syntax is wrong or um kind of makes it much easier than just typing in the terminal and trying to figure out why you're getting errors. So I really like VS code for that reason. um That da da da da VS code. There's plenty of editors, but VX code is good. Python on different operating systems. So I guess Python on Windows, there's different commands. m I am running on a MacBook Pro. So I will be um focused on sections that talk about Python on Mac OS, which is right here.
09:44
It is not installed by default, so you'll need to install it you haven't already done so. In full transparency, I did start this book probably two or three months ago, and I actually enjoyed it. um So I'm just right in the very beginning here, page 10, so I didn't get very far. So I figure we'll just start over and do this. But I think I already did install Python, but we'll go through the process here. I already did install the IDE, which is VS Code, which will be our text editor, and I uh already installed the Python.
10:13
library or not the library that plug in whatever the heck it's called the extension. We'll see it here shortly. So we're to go through all this, but just in case you see on my screen that some stuff already looks done, like I'm already, already have Python installed. It's because I did a little bit of this a few months ago when I got started. So I'm just starting over here with you. All right. So you can find the Python installer at python.org hover the download link, blah, blah. So let's just look at that just for fun skis allow. All right. Bear with me. I'm dealing with the ultra wide here and the
10:43
these are virtual desktop because if I try to just share my screen, it'll look awful. All right, so we're at python.org. I did do this before I came in here. I clicked download. I just went through the instructions here that it's giving us. Oops, now I'm fighting my, sorry. um
11:03
Open a terminal to see if it's installed, applications, utilities, terminal. So I remember I went through all this. I did not have it. I installed it at that download link I just showed you. After it installs, a finder window should appear, double click, install, blah, blah, blah, run. you just want to follow the directions here. It's not too heavy if you've ever run, you know, if you ever installed anything, which you probably have at this point, this should all be pretty familiar. Back to my terminal, which I have lost in the chaos. Whoops.
11:32
Oh, this virtual desktop, man. I do not like it. So once it's all installed and you go through all the installation stuff, you say you can now try to run snippets of code in the terminal by typing Python three. So I don't know if it's control V is not what I wanted. m
11:54
I do not know how to get out of this. But as you can see earlier, I typed Python three here and then I got yelled at. And then how did I actually get in here? This is funny. It was Python three, no space. That's how I got in. So down here in Python three, and then we got the, we're in the interpreter here. So anyway, I'm just catching us all up with the textbook and where I'm at and what I've done so far. Scrolling down.
12:25
Um, this command starts a Python terminal. You should see the Python prompt, which are these three greater than signs. There's probably a name for them that I don't know. All right. So, um, a Mac OS has found the version of Python that we installed. Yay. Um, we're going to do this in the interpreter to test if Python is working. We are going to per the instructions in a textbook, the bold.
12:52
It means that's what we type in the interpreter. hopefully you can see that. Let me know if this is too small. Let me look and see if it's Call of Duty. Yo, yo, yo.
13:07
Call of duty. 2D.
13:20
Just asking if you can hear me. um Can you see the screen? Okay. Is the text large? It's very weird. I'm not a streamer as you can tell. So I'm very much out of my element here. I don't know if you can, I know you can hear me because I'm a podcaster and my setup works. I hope you can see this. I hope the text is big enough. I guess let me know in the chat.
13:48
If there's anything I can do to help make this easier from your side, watching, and I will adjust accordingly. So.
13:59
1130 a night here on the East Coast of the United States and I am streaming myself trying to learn Python. We're going to do this people. All right. So print, print quote. Hello. Can't spell. Hello, Python.
14:20
interpreter exclamation, end quote, and print and enter. And look at that. So let's see what the textbook tells us we just did. You should see the message, hello, Python interpreter, which should print directly in the current terminal window. You can close the Python interpreter by pressing control D. uh I tried every other combination I can think of and it didn't work. Let's try control D to see if we can close that out. uh Cool. All right. So to get in,
14:48
to the Python interpreter, Python three, enter, we're in. To get out, control D. What are the chances I remember that? Not very good, we'll see. All right. Python is installed, I downloaded it. It was not downloaded. Oh, you know what? I kind of remember, so I did this before. I think there was some kind, I got a prompt that I had to download something in Mac before.
15:15
I downloaded Python. made me download some kind of library or I don't know. Anyway, follow the directions of every computer says do the thing. Download Python, install it, open the interpreter, make sure that it works. Print hello Python interpreter, control D to get out. That's where we're at. Uh, the next step is installing VS code, which is going to be our editor for code. Um, my understanding is in the terminal window, you know, everything you do is being executed and interpreted as you type it where in VS code you can write it all out.
15:45
I'll check the syntax and um do things before you run the code. Whereas I think in the interpreter, every line you run, it just executes. Could be wrong. All right, so nobody's writing me back in the prompt, so in the text. So I am just guessing that everybody can see everything. Everything's fine, and we're good. ah There's also a lag, which might be why you guys aren't answering me.
16:17
All right, moving on, install VS code. It's gonna be our code editor. ah So we wanna go to this website here, allow. Let's see what they show us. All right, the open source code editor. Oh, of course, now there's AI slapped on it, because why not? If your product doesn't do AI, I mean, what's the point, man?
16:43
God, I really like AI. use it a lot. It's amazing, but I'm also just so fatigued by it. All right. Sorry. I just, when I went to the site, it says the open source AI code. All right. So click download. did that before, so I'm not going to do it now. I'll follow in the directions here. um
17:09
Go to the downloads, drag it to your application, double click it, install it, blah, blah. um Skip over the following section about Python on Linux and follow the steps for running a Hello World program.
17:24
Linux systems are designed for programming. right, so we are, okay, now there, so it was Windows and it was Mac OS. Now it's saying this is how you do all the things in Linux. So we're gonna skip over that and go to page nine, which is here. All right, running a Hello World program in VS Code. Excuse me, sorry, I'm getting over a little thing here. Apologize if I cough in your ear. All right, let me launch VS Code as we downloaded and installed it.
17:54
Um, somewhere here in my doc. What do I do with there? is my VS code. All right. Before you write your first program, make a folder called Python underscore work on your desktop for your projects. It's best to use lowercase. I did do that. I do have a. On my desktop called Python work. You can see up there. And I believe this is the hello world.pi that I did, but we'll do it again here. Open VS code, close to get started, make a new file by clicking file new or control N.
18:22
New file, oh, command N. Helps if you do what it tells you to do. All right, cool. So we just opened a new file in Visual Studio Code, which is this. Save the file as helloworld.py. Python work. I'm putting in that folder and then I'm gonna save it as hello, underscore world. I'm actually gonna name it two, v2, because I think I did this before. But I'm starting over because we're doing this together, .py. All right.
18:51
Save the world v2.py. Cool. If you save your file, enter the following line in the editor. All right. So print hello world. I'm gonna try to do this without locking print. uh quote hello world. What did it say? Hello, Python interpreter. Hello, Python world. Fine. Hello.
19:19
Python world. All right, now I did not enter that close or end paren. I think I did it for me, which is one of the magical things with this Python extension that's in here. Let's see if they refer to that at all. To run your program, select run or press control F5. Run without debugging.
19:44
think you have to save. See this little white dot up here? It means that there are unsaved changes. I don't think it's a big deal, but let see, how do we save? it? oh Yeah, so watch this. This should go away if I do command S. All right, cool. That white thing goes away, which means I don't have any unsaved changes. Now, Chrome without debugging.
20:11
wanted to bugger. So when I click run, I the bugger.
20:21
Run without debugging and then it asks me to select a debugger. Well, let me just pick one so it stops bugging me. All right. Well, I think it worked because it says, hello, Python world down here. I'm not exactly sure why it's giving me a hard time. So it's weird. I selected run without debugging and then it made me pick a debugger. I don't know what's happening, but we got it to run. It says hello, Python world there. So it's running. Don't know what I'm doing, but it worked. Great.
20:49
Hey, listen, we'll vibe code next. You don't have to know anything. I kid not really. All right. So we've got that to work moving on. I love how it says here. Take step away from your computer. Take a short break, break, try again. That's actually really good advice. I can't tell you how many times I've been deep in the weeds troubleshooting and I just need to walk away and give my brain a break. And when I stopped thinking about the problem, the solution comes, there's some science behind that. think it's got something to do with like.
21:17
your brain waves and I think when your brain goes into Delta waves, where you're not thinking about the problem anymore, it actually, you're not conscious you're thinking of the problem, but then your brain does some magic and solves the problem and then brings it up to consciousness and tells you the solution. So I don't know, man. Uh, if you're ever stuck in a problem or troubleshooting walk away, take a break and the answer might come to you. That's happened to me a lot, which is very good advice in this book. I think we got.
21:41
to the end of the chapter here. All right, so in this chapter, you learned a bit about Python in general, and you installed Python on your system. If it wasn't already, you also installed a text editor to make it easier to write Python code. You ran snippets of Python code in a terminal session. You ran your first program, helloworld.py, yay. You probably learned a bit about troubleshooting as well. In the next chapter, you learn about the different kinds of data you can work with in your Python programs. Let's get into that. Variables and simple data types. Honestly, this is where sometimes I start to get a little...
22:10
fuzzy and lost, let's just get into it. Let's take a closer look at what Python does when you run hello world.py. As it turns out, Python does a fair amount of work, even when it runs a simple program.
22:22
When you run this code print hello Python world, should see the following output, which we did eventually. When you run the file, hello underscore world pie, the ending dot P Y indicates that the file is a Python program. Your editor then runs the file through the Python interpreter, which reads through the program and determines what each word in the program means. For example, when the interpreter sees the word print followed by parentheses, it prints to the screen, whatever is inside the parentheses.
22:49
As you write your programs, your editor highlights different parts of your program in different ways. For example, it recognizes that print paren is the name of a function and displays that word in one color.
23:07
code and see. All right. So can you see that? I think he can. So yeah, displayed print in yellow. So it did see print as a function and displayed it in a different color as the textbook says. And it's because it's a function.
23:26
This feature is called syntax highlighting and is quite useful as you start to your own programs.
23:34
It recognizes that hello Python world is not Python code and displays that phrase in a different color, which we can see there. So that's syntax highlighting. All right. So BS code saw that print paren was a function. Ooh, look at this. If you hover over it, it tells you some stuff. It sees print paren as a function, which is a different color. And then it sees hello Python world as not Python code and displays that phrase in a different color.
24:01
So uh VS code will use colors to help us understand, I guess, different functions and syntax and stuff in Python. I will take all the help I can get. Thank you, VS code. All right, variables. Let's try using a variable in HelloPy, helloworld.py, adding a new line at the beginning of the file and modify the second line. So message equals, oh boy, here we go. I can already feel my brain trying to resist this.
24:31
And I know it seems so silly, but I'm like, wait, what are they doing? What's happening? Things are about to get weird. We're going to try to use a variable. We're going to add a new line at the beginning of the file. So let me pull a VS code again. Yeah. Good call. um may immediate UK in the chat says they use AI to explain and simplify the knowledge. helps deep seek is greater teaching. The only problem I have with using, I generally use chat GPT. I pay, you know, whatever it is, 20 bucks a month. And I like it a lot. It helps me a lot.
25:00
The only problem I have with that is that because it lies convincingly, I don't know when it's lying. And when I'm learning something technical like this, and maybe it's just cause I'm old school, I much prefer an actual book written by an author that isn't hallucinating. That's giving me facts. Um, but I don't disagree with you that AI is a great tool, but
25:24
Before we had LLM so readily available, know, you would Google stuff and there seemed to be more vetting of information and you could tech like check two websites and like, okay, they're both saying the same thing, different sources. It's probably true. I feel like if I asked chat GPT something and it lies to me or hallucinates, I have no way of vetting that information. It kind of reminds me of like labbing in a virtual environment. And then you hit something weird that doesn't seem right. And you're like, is this a bug? Is this a limitation of virtualization?
25:52
where I've always been much more comfortable in hardware, in routers and switches and servers. Same reason. I guess this is basically like my hardware, right? So anyway, um big fan of AI. I'm cautious of it when I'm studying highly technical things because I want the information and I want it to be correct. And using a tool that will absolutely make stuff up um concerns me, but whatever. I know plenty of people who use chat GPT primarily to learn coding and they have nothing but good things to say.
26:22
I like textbooks. ah I do have a project I'm going to do. one of the next videos I want to make is I'd like to start making content around coding in Python. And I asked ChatGPT if it could go through all my published podcast episodes and find any episodes that didn't have a transcript uploaded.
26:44
and it spit out some code and said I could just run it and tell me what, you know, I guess that's like five coding, right? Like tell me how to do a thing and it gives me code and I'll just run it and see. So that's something I want to try and I have the code. just haven't done it yet, but anyway, I'm agreeing with you. Yes. AI is a great way to learn stuff with a few caveats. All right, we're going to add a variable. So this is our hello world script. So we are going to prepend and see if I hit enter and go up. Good message.
27:15
So I think a variable is a value that we assign to memory. So message equals hello, add a new line at the beginning of the file, modify the second line. Oh, I see what they're doing here. All right. Message, hello, Python world.
27:37
Gotcha. Down here, we're going to print message. Again, you see that white dot right here. means there's unsafe changes. So command S and then we're going to run this, which I think was, what was the shortcut to run it? Uh, run without debugging. Was that an R? So it looks like it worked. We set a variable. See if I scroll over this, will it explain what a variable is?
28:07
So we set a variable, which is a value in memory, we said message equals, and then the value that we're putting, that we're assigning to message is Hello Python World. And then we printed the name of that variable message, which then down here printed us out the value that was sort of memory. So this is the first concept that I think I don't get confused about. Variable I'm OK with. Assign a value to something. I get that. That makes sense.
28:36
Back to the textbook. Should see this output. We've added a variable named message. Every variable is connected to a value, which is the information associated with that variable. In this case, the value is hello. Python world text. Adding a variable makes a little more work for the Python interpreter. When it processes the first line, it associates the variable message with a hello Python world text. When it reaches the second line, it prints the value associated with the message to the screen.
29:05
Let's expand on this program by modifying hello world pie to print a second message at a blank line of hello world pie and then add two lines of code. So variable message equal hello Python world print message. All right, then we're to do a space and then we're going to set. um So message hello Python course world. I think what it's teaching us here, I'm not sure yet, but I think we're going to overwrite.
29:34
the value of the variable message from hello Python world to hello Python crash course world. And then when we print, going to get, we're going to see that this is going to overwrite the value of this variable. Message equals hello Python crash course world. This is the problem working in tech. It's almost midnight on a Saturday night. Most of my family's asleep.
30:02
And I'm down here trying to teach myself Python as a pretty much middle-aged dude, like, come on, man. You know what mean? It just never ends. You have to love learning working in tech. Print, which we learned as a function. Message, which is the name of our variable. And then, so the first thing I'm to do is command S to save changes. Now that little white dot goes away. And then I'm going to hit the play button. So we um overwrote.
30:32
the value of the message variable and when we ran it, we saw, oh wait, did it print both? Wait, it didn't overwrite it? Oh yeah, look at that. So I am wrong. I thought what was gonna happen was, so we have a variable named message with two different values assigned to it and when I run the program, it prints them both. I would have thought line four,
30:58
would have overwrote the value of line one and we only would have seen this in the output. So I am surprised that we see both. Let's go to the textbook and see why.
31:18
All so we are at this section here where we um added a blank line and then two more lines of code. Yeah, I'm really not understanding. Let's see if it tells us why. Now when you run it, you should see two lines of output, which is what we saw. You can change the value of a variable in your program at any time and Python will always keep track of its current value. Well, if the value of the variable in, see how I'm going with this, right?
31:47
We have variable message. We assigned it two different values and it gave us both of them. I would have thought variable message could only store one value at a time. And I would have thought that we overwrote the first value with the second value, but that's not what happened. But this is saying Python will always keep track of its current value. So maybe it just appended it and added it. More will be revealed people. More will be revealed.
32:16
Philip says it's because Python goes line by line. It's printing the first value, then it changes, then it prints the new value, executes top to bottom.
32:29
Yeah. mean, right. I see that it did that. I guess I was under the mistaken assumption that a variable can only hold one value. And it seems to me that variable named the message is holding two values or two pieces of information. Hello, Python world and.
32:50
Hello, or the second one was that, um, hello, Python crash course. So it's all good. Just, it's not what I expected and it's fine. All right, let's finish up variables and then we'll pick up next time with strings. So naming and using variables. When you're using variables in Python, you need to adhere to a few rules and guidelines. Breaking some of these rules will cause errors.
33:13
Other guidelines just help you write code that's easier to read and understand. Be sure to keep the following rules in mind when working with variables. All right, so we got some rules when working with variables. Variable names can contain only letters, numbers, and underscores. They can start with a letter or underscore, but not with a number. For instance, you can call a variable message underscore one, but not one underscore message. Cool. Spaces are not allowed in variable names, but underscores can be used to separate words.
33:42
For example, greeting underscore message works, but greeting message will cause errors. Avoid using Python keywords and function names as variable names. It only holds, I'm reading what you wrote, Ryan and Phillip. It only holds one value at a time, but the first print happens before you change it. So you're printing two versions of the same variable. All right, man.
34:12
I'm going to take your word for it. know you're right. It just breaks my brain. My, I thought how variables worked is it can only hold one value at a time. And when I create the second message equals whatever it would have overwrote the first because you changed the value of it. It's not holding both. All right. It's all good. I don't want to get, I'll get hung up on the axle and you know, it's, I just need to let it go, but I don't understand.
34:41
might happen, but I believe you guys in the book that that's what happens and that's what's supposed to happen. So all good. Avoid using Python keywords and function names as variable names. Oh, that makes sense. For example, do not use the word print as a variable name. Python has reserved it for a particular purpose. mean, that's common sense. Variable names should be short, but descriptive. For example, name is better than N. Student name is better than SN. Right. So it should be descriptive of what it is.
35:12
Be careful when using the lowercase letter L and the uppercase letter O because they could be confused with numbers, right? You can take some practice to learn how to create good variable names, especially as your programs become more interesting and complicated as you write more programs and start to read through other people's code, you get a better coming out with meaningful names. So my brain wants to jump ahead and ask why we need variables. Like, what are we going to do with them? I know we're going to do something with them later besides just print hello world. And I guess that will be revealed at the proper time, but.
35:40
That's where my brain goes is like, why do we need variables? What are you going to do with them? I guess we'll call them later. Right? Isn't that like a thing in programming, like call a variable or pulling a value to do a thing. And I guess I just need to pump the brakes and relax and I'll learn it when I learn it. Um, the pythons, here's a note, the Python variables you're using at this point should be lowercase. You won't get errors if you use uppercase, but uppercase letters and variable names have special meanings. We'll discuss them later chapters.
36:10
This is the stuff I love. right. Avoiding name errors when using variables. Every programmer makes mistakes, and most make mistakes every day. Although good programmers might create errors, they also know how to respond to those errors efficiently. Let's look at an error you're likely to make early on and learn how to fix it. All right, we're almost done here with variables, and then we'll call it.
36:38
Variable message equals message. All right, I misspelled message. I totally misspelled it. Massage message. All right, it's actually given me, is it giving me an error here? I feel like it's telling me that I messed something up. Come on, man. Hey, there it is. Massage message. I don't know why I said it is not defined. So VS code is telling me that I screwed something up, which is nice, but I'm gonna save it, command S, and then I'm gonna.
37:07
Press the play button. So we got this little red guy. Command executed, took 42 milliseconds and failed. It ran Python three from usrbin users desktop. It pulled from my thing. There's my trace back. Trace back is like an error thing, right? I think I saw that earlier. File, mya, line eight. So that's cool. tells you where in the error message it says inline eight is where the problem is.
37:36
And then it says name message, M-E-S-A-G-E is not defined. Let's go back to the textbook.
37:44
When an error occurs in your program, the Python interpreter does its best to help you figure out where the problem is. The interpreter provides a traceback when a program cannot run successfully. Oh look, it's going to tell us what a traceback is. So I don't have to make it up. A traceback is a record of where the interpreter ran into trouble when trying to execute the code. Yeah, that's really cool. I like that. That's helpful. Here's an example of the traceback that Python provides after you've accidentally misspelled a variable's name. Traceback, most recent file that we aligned to, print message is not defined.
38:15
The output reports that an error occurs in line two of the .py file. The interpreter shows this line two to help us spot the error quickly and tells us what kind of error it found. In this case, it found a name error. Reports of the variable being printed, massage, has not been defined. Python can't identify the variable name provided. A name error usually means we either forgot to set a variable's value before using it.
38:36
Or we made a spelling mistake. If Python, a name error. Okay. If Python finds a variable name that's similar to the one that doesn't recognize it, we'll ask if that's the name you want to use or meant to use. That's nice. In this example, we omitted the letter S and the variable name message in the second line. The Python interpreter doesn't spell check your code, but it does ensure that variable names are spelled consistently. For example, watch what happens when you spell message incorrectly in the line that defines the variable.
39:05
case the program runs successfully. Variable names, whoops, the variable names match, right, so Python sees no issue. Programming languages are strict but they are disregard good and bad spelling. As a result you don't need to consider English spelling and grammar rules. Many programming errors are simple, single character typos in one line of a program. If you find yourself spending a long time searching for one of these errors know that you're in company. Many experienced and talented programmers spend hours hunting down these kinds of tiny errors.
39:34
try to laugh about it move on. I would probably throw a chat GPT and say, what's wrong with this? Right? That's probably the thing to do. Variables are labels. Variables are often described as boxes you can store values in. That's a good visual. This idea can be helpful the first few times you use a variable, but it isn't an accurate way to describe how variables are represented internally in Python. It's much better to think of variables as labels that you can assign to values. Labels you can assign to values. Yeah.
40:02
That makes sense. You can also say that a variable references a certain value. Sure. This distinction probably won't matter much in your initial programs, but it's worth learning earlier rather than later. At some point, you'll see unexpected behavior from a variable and an accurate understanding of how variables work will help you identify what's happening in your code. The best way to understand new programming concepts is to try using them in your programs.
40:30
If get stuck while working on an exercise in this book, try doing something else for a while. I love that. Keep saying walk away. That is it for variables. Thank you very much for joining me in my first Python study group or my first Python study session. I am going to keep hopping on here. Python crash course by Eric Mathis, third edition. We will continue going through this book. I don't know how far we're going to get. Hopefully to the end, that would be great. If we can and we can.
40:57
build a community around us and learn some Python together. think that would be amazing. Thanks everybody. Hey folks, if you like what you heard today, please subscribe to our podcast and your favorite podcatcher. You can find us on socials at Art of NetEng, and you can visit linktree.com for links to all of our content, including the A1 merch store and our virtual community on Discord called It's All About the Journey. You can see our pretty faces on our YouTube channel named the Art of Network Engineering.
41:25
That's youtube.com forward slash art of net edge. Thanks for listening.