Advantages of Completing Small Python Projects | Real Python Podcast #77
Key Takeaways
The Real Python Podcast #77 discusses the advantages of completing small Python projects with author Al Sweigart, covering topics such as writing technical Python books, creating video courses, and sharing knowledge. The podcast highlights the importance of small projects for beginners and intermediate programmers, providing practical steps and tools for completing these projects.
Full Transcript
welcome to the real python podcast this is episode 77 are you a beginner or intermediate python programmer who's made it through some of the fundamentals have you tried to tackle a big project but got stuck and frustrated completing some small projects might be the answer this week on the show we have author al swigert to talk about his new book the big book of small python projects we discuss the advantages of sometimes thinking small in terms of python programs we talk about completing projects and the benefits of manually copying code by typing it in yourself i'll also have suggestions about tools for beginners and intermediate developers this episode is sponsored by rev ai the most trusted way to build global speech to text to insights products and workflows all right let's get started [Music] the real python podcast is a weekly conversation about using python in the real world my name is christopher bailey your host each week we feature interviews with experts in the community and discussions about the topics articles and courses found at realpython.com after the podcast join us and learn real world python skills with a community of experts at realpython.com hey al welcome back to the show hey it's great to be back on here again yeah you've been busy you've been making books all throughout this wonderful time yeah that's been pretty cool that's that's what i would like people to to think yes i've been very busy and productive and not just sort of staring at the wall during the pandemic well it seems that way from the outside um definitely i really like the format for your new book the the big book of small python projects so i have a bunch of questions about that generally but i thought maybe we could start off talking about you were on a panel with a bunch of other python authors at pi cascades and i thought i could include a link for that i think it's really interesting kind of some of the stuff you guys got into there about it was basically everything a very lofty title everything you need to know about writing technical python books i i saw that title i was like i think we're going to need more than 45 minutes yeah so what were the kinds of things you covered in the talk um mostly that it was uh of course a lot more work than i realized and uh just talking about the the general process that i have which isn't too much of a surprise i usually just start with uh considering the audience of who this book is for because i don't want to write something that other people have already written about and yeah i start with an outline and i mostly just try to get the table of contents set and then i just sort of fill in the skeleton from there where i just make notes of like hey i sort of want to have a paragraph about this and a paragraph about this and i'll have a a random text file of scratch text that i've written that i i'm not going to include in the book but also i really have trouble letting it go so i take it out of the book and i put it into the scratch file where nobody will ever see it but it's it's not the same as as as just editing ads sort of like uh checking in commented out code okay i know it's probably a bad habit but but i kind of do it anyway and then i also have other text files of just sort of whenever i think of a thing that needs to go back into an earlier chapter but probably affects a lot of other bits of the book i mean it's it always i'm always astounded when i get done with a book project and it's just a book that you can read from front to back and that was very much not the process of creating that book yeah sounds like it that's interesting i i approached making video courses in kind of a similar way with definitely the table of contents part but i always come back and create an introduction really after all of it because it really makes more sense to like yeah teach people like this is really what we're going to cover and this is what you know what's important and then kind of the same thing with like a summary at the very very tail yeah i always i always do the introduction chapter last because i start off uh writing the book about what i think it's going to be about and then i finally realize what the book is going to be about and that's when i need to write the introduction i i find it interesting that i think of it almost as like uh you're commenting your writing like you'd comment your code this that technique sounds interesting um that it can help you maybe remind yourself of previous versions but also like where where is this supposed to go kind of is that kind of the idea or yeah i mean mostly it's it's a code smell it's sort of a bad habit to comment out code and then check that commented out code into source control because it's so well this this code isn't running because it's commented out so why are you why are you making a record of it as opposed to just commenting out code uh temporarily just to to debug things or try things out but yeah it's sort of in that in between space of i need to get rid of this because i don't need it but i also kind of want to hang on to it anyway just in case so for for like 200 pages of book i'll usually have about 50 to 100 pages of scratch notes that i just uh wanted to put in but it just really didn't i didn't have a place to fit it do you have a favorite tool you write in uh everybody is always astounded when i say this to write books i use microsoft word i don't see anything wrong with that that's totally fine that's what it's designed for uh there there was a time when i first started out where i thought like okay i need to learn latex or latex or however it's pronounced and then just trying to figure out how to do basic things like hey i want to have this image in the center of the page horizontally but not vertically and uh 45 minutes later i'll uh finally sort of figure out how that works and then i want to add page and it just got to be a huge headache and i when i started working with no starch press they just provide a ms word template to use and well yeah that it works they'll later take it and then pour it all that's just used for the editing they'll pour that text into um i think like adobe indesign or some other desktop publishing tool yeah layout thing yeah okay yeah for proper layout when you started out programming i know we talked a little bit about this in our previous episode what i'm wondering about though kind of the rehash it may be a little bit is were you like a project type of person were you taking other people's code like out of a magazine or a book and and typing them in when you were learning to code yeah that's exactly how i learned there was a friend of mine in elementary school found a book in the library about basic programming and so i basically had that book and then the uh the reference manual that came with the compact 386 computer okay that you know it was technically it's a reference manual for basics so it has all the information in there and i i would read through that book and just not understand any of it whatsoever because they would just throw all this jargon at you and uh i was just like well i want to make mario how do i make mario right and but the other the other book sort of just mostly taught through examples it had the source code for a bunch of little games like tic-tac-toe actually tic-tac-toe was the most complicated game at the very end of the book and i could never get it working correctly but a really simple like guess the number text based games and i could actually understand that and just from playing around with the uh the source code i could see all the i noticed all the patterns for between the different games and you know i really hate telling the story of how i learned to code because i'm one of those kids that fortunately grew up with a pc in the house right and it sort of makes people think oh in order to program you have to have started when you were you know two years old or something like that but really like all the the quote unquote games that i made for probably about the next eight years of my life were variations of those guess the number games i there there really wasn't that much to game design i guess it wasn't really a thing so much as it is now yeah yeah i experienced that too i i know what you're saying that there were some tools that were out there um game maker kind of things but in general i was creating really simple text kind of games um i had a atom computer which is like a thing that bolted onto the colecovision or whatever and made it made it a computer and that was really my first one where i could kind of hack on it but it was you know very simple ideas at most i could get like you know individual like blocks of like not even like individual pixels moving around the screen so it was very very basic yeah i remember there was a thing called click and play okay that apparently was very popular in the 90s i remember it came with the pc that that my parents got when i was in high school and i looked at it and played around with it a bit and had no idea how to use it so i i promptly put it away and never touched it again and and now you know here uh you know 20 years later i'm reading about other people who are like i remember click and play i made so many games with this and it was so much fun and i really opened my eyes i thought like oh yeah wow well i missed out on that i guess um yeah totally yeah i wanna i do wanna focus on maybe a little bit later i had a conversation with marlene montgomery about the lack of resources for a lot of people just even to get to a computer or maybe what they have is like a phone or some other kinds of things and i think it's neat how in your book you have you know ways to kind of access that code for for people who maybe don't have an actual like you know sit down at a desk you know computer sort of situation i guess we could talk about it right now but um i i think that was that important to you to include those kinds of um you know other methodologies so people don't feel like excluded oh yeah yeah that was um that was a big part of all the projects that i have in this book so starting from the beginning the book is the big book of small python projects and it's for sort of beginner intermediate programmers right who maybe they've gone through a hello world tutorial with python and but they don't really know how to sit down and write a program and so this book doesn't really have a lot of of prose that teaches people how to program and explain concepts instead it's just basically just the source code for 81 different games and simulations and little animation programs but they're also all most of them are text based you're just using print and input essentially there are a few games that have colorful text but i'm basically just sticking with ascii art and i was i was sort of worried that i was dating myself when i did this because i mean i've talked to other programmers and who give me the line of like well what they should be teaching the kids these days to get them into programming is exactly the same things i did as a kid when i learned how to program and so i was really worried about that but but i also had the realization that the text-based medium was really great for keeping these programs simple because you could since this the source code is in text and the output of the program is in text so you could always take some part of the output of the program and then trace it back to you know the the print call right that actually produced it and so you can it's a lot easier to develop that cause effect relationship between what code you write and what the code does and so i had i started writing down a whole bunch of other you know what would be good small projects for for people to learn because you know once people have gone through those hello world tutorials and they want to move on to some more intermediate content or learning materials it becomes really hard to figure that out and sometimes people will tell them like oh you can just take a look at open source projects but you know if you've just gone through hello world you don't want to start looking through the linux kernel source code as uh for like oh this is how real programs work because that's uh so hard but even even other you know uh smaller open source projects these are written by professional software engineers mostly they might not have good documentation or they might not even have any onboarding materials for for new contributors and so that's that's a huge wall that you suddenly come to so i wanted to think of like well what if we had very small projects that were simple they don't use there's no additional libraries that you have to install and so i started writing up a list of sort of the the design uh features that i i wanted to follow or the the design rules for all these projects and so they are keeping them small i i chew i chose 256 lines of code as my arbitrary limit just because it's a power of two um and nice yeah i i was i was thinking like how can i explain the significance of 256 it's like well it's two to the eight and that's the number of integers you can represent with a single byte and i i realized i was like going off on a tangent so i just call it uh powers of two are lucky programmer numbers so there you go totally yeah so i want them to be small i also wanted them to be text based so that you don't have to install or worry about graphics and mouse input and screen resolution and and also being text-based it really lowers the expectations i guess of of these programs because they're just small games that are supposed to be amusing for about five minutes and uh i think minecraft did this beautifully with its retro pixel art style where just by making the graphics look simpler as the aesthetic it really eased the burden on for the developer because the the creator of minecraft was just a single person when he started out and so you know he didn't have a lot of time to make incredible art for his game so he just started off with just blocky looking graphics and it just became a style in its own right yeah totally so i decided do you just stick with text and then maybe some ascii art that you can you know using the dashes and underline characters as lines and or the back and forward slashes as diagonal lines you can start drawing pictures with just text characters placed around there so it would be enough to convey sort of like a playing card or or very simple graphics that way so small and text-based with no additional modules that need that you need to install i have a list of a few modules that some of the games require such as piperclip to just copy and to add copy and paste features to the program but for the most part you can just use them use the python standard library for for all of this and that allows it to really be universal like you have eliminated all these like you said the complexity of additional packages and the the platforms that they would have to run on it's like if you can run python you can basically run any of these small programs right yeah i mean uh some of the some of the programs will have like a level file that they'll read from but for the most part they only use standard i o uh for the text input and output so you can run most of these programs on python anywhere or these these browser-based python interpreters so you don't even need to have python installed on your computer then to to actually have it run play around with and then another great thing about not having additional libraries that you need to install is that the code is a lot more portable so if this book does well i could do a big book of small javascript programs or small java programs or small c sharp programs and and the code translates fairly well so that's that was also something that i had in mind when i when i started writing this book as well yeah i can see that and and like you're saying that generally it's going to be a single file that the thing's going to run on but like there are a couple exceptions there where it might be a couple one of the things that you were saying before that was the idea of like learning and going and looking at some large project out there like a flask or a django or some other you know something somebody says oh you should just go look at source code is this going to be multiple files reference each other and you don't even know how they tie together and so that this is definitely going to you know you can kind of hold it maybe almost all of it in your head you know depending on you know how good your memory is as far as active ram yeah yeah that's that's such a huge thing with with programming too and programmers are also sort of to blame for that just because what software developers love doing is creating hierarchies of concepts or files yeah and and we think we're adding organization to our code but really we're just adding a sort of bureaucracy to our code projects but because you know in our head it makes sense like oh well this these should be this code should be in this file because it's related to this other thing and then you've created this complicated system of folders and subfolders and sub subfolders with other files when really you could have just thrown it all into one dot py file yeah definitely so so yeah i i've kept all of them in a single python source file and the other nice thing about that too is that it makes it a lot easier to share as well one of the big problems with with just passing code to someone else and getting it to run on their computer is that you have to do all the environment setup and and everything else but for all of these you can just uh do a select all and then copy and then paste it into a forum or into an email even as long as it doesn't mangle the white space but it's just a single file that they have to deal with which yeah every every time that you have something that the user or the reader needs to do you're probably going to lose about half of your audience for each step and so you know if they have to install some some graphics library half of your readers aren't going to be able to get that and then they're just out of luck and they can't progress any further and then i guess they become accountants or lawyers or something else besides software engineers um yeah and yeah yeah that's interesting way to look at it the the the dividing your your audience as you go um i have experienced that though like in trying to follow other online tutorials where you were hoping that it was going to be for uh you know particular like kind of a universal platform like you're showing me this concept but pretty soon you're like okay well that guy had linux and or whoever wrote it had that particular flavor of stuff and didn't really think outside the box and you're right you stumble into it and you're like i don't i'm just trying to learn here and i'm now having to research you know all these different potential options or how it works on my machine which is super frustrating yeah it's it's 1998 and i'm using click and play all over again yeah oh well this looks really cool but i can't actually do anything with it so i'm just not going to touch it ever again [Music] rev ai the most trusted way to build global speech to text to insights products and workflows trained on more than 50 000 hours of human transcribed verbatim speech data covering a wide range of topics rev ai offers developers unparalleled speech recognition accuracy with word error rates lower than similar solutions from major players like amazon and google your first five hours are on us try us out today at rev ai that's rev dot ai [Music] i like your instructions for the the steps in the book the idea of you know obviously it's a book anybody kind of approach it how they want but you have a suggested methodology to kind of get people going i don't know i thought it was clever and i like the steps especially for a beginner that they can kind of get an idea of what's happening is okay we just kind of go through them a little bit yeah yeah the uh the advice that i that i give to readers is to essentially just sort of first of all run the program just you know copy and paste it and then run it and see what it does so that you have an idea of what you're actually creating uh what was mine supposed to be when i'm done with it um yeah and then that way you know they can also just play these games or and have fun and it sort of just builds up excitement and also they can see like oh these are these are fairly simple programs you know i'm not setting out to make minecraft in a single weekend or anything like that right and then after after playing around with it i tell them okay just erase everything and just copy by hand the code out of the book just typing it along and i don't i have no like major research to back me up but for me anyway just writing out the code is i get used to it i think it just slows me down enough that i have to pay attention to each line since i'm typing it out if i'm just reading the code or if i'm just copying and pasting it i you know i very quickly just like glance over and i don't actually know what i'm doing and and after you're done entering it yourself just go ahead and run it and then there's going to be errors and so pay attention to sort of the the airline the error messages i feel like that's another part of programming that really trips up beginners is because i don't think any programmer ever really writes an error message thinking that a human being is going to read it one day so i mean python had like syntax error invalid syntax yeah for the longest time and then in python 310 they've started adding a lot more descriptive error messages which i yeah i'm excited by that we've been talking a little bit on the show the the idea that there'd be like these little sort of symbols like carrot kind of you know going back to your ascii art thing yeah you know actually pointing at like this this is what's going on that's potentially the problem as opposed to very often it would be showing you well i got up to here uh and then it failed and so you're like maybe looking at the wrong place as to where the the error might be happening and it's it's nice i'm liking this new stuff that they're adding yeah i think you talked about this in in an episode but where you would get a zero divide error but it wouldn't show you uh before where exactly that zero divide was happening so if the line has multiple divisions uh operations in it uh you're sort of just you have to guess as to like oh what was set to zero here scratching your head yeah yeah yeah the pep is good and i don't have it on top of my head but i'll definitely include a link for it and it has the actual written examples which is a nice thing about the peps too being a documentation thing that they're they're including more and more examples at least in my opinion i'm you know fairly new to language but as i'm reading more about it and and seeing this kind of stuff added to the language it's definitely making me feel more comfortable with it all the time and it becoming even an even better you know teaching tool yeah that's something that i've really noticed with programming is uh you know because these you know improved error messages that's not a new programming language feature or or some new algorithm or something like that right but it is incredibly important because i feel like python's popularity is mostly because it's a programming language that has the gentlest learning curve possible for beginners so it's it's not just computer science majors who can you can learn to program with it it's really anybody who has a small interest in programming yeah yeah the intimidation factor for programming has always been uh much larger of an issue than you know if how good you are at math or or how old you are when you start to learn how to program yeah it always seems like people are sending you off to hogwarts or something you know and you're gonna become like this magician and when you come back they're not gonna understand anything that you're doing you know it's like no actually right and on top of that the magicians also don't really understand what they're doing that's true too funny but yeah uh so you know type in the code uh fix the errors that come up and then i i also sort of say like well and then at the same time just re-implement it on your own you don't have to copy it exactly the way the other the program originally ran so you're not memorizing code yeah but you can make your own version of it which is so much more realistic than than just following along with the code in a tutorial or something like that and hopefully i've i've have i have sort of a range uh some of these programs are really simple and they're just sort of like 20 or 30 lines of code and then some of them i actually do break that 256 line limit um but you know usually they'll just be around like 200 something lines of code and uh that's small enough where you know for beginner that could be like a weekend project yeah totally or something that they can work on or an afternoon or whatever yeah yeah yeah and a lot of these there's there's 81 of these projects so if you don't like one thing you can probably just skip around i have them listed in alphabetical order i realize that's probably the the easiest way just to have them and then in the back i have uh sort of an index uh each project has has a set of tags with it so some of them are like marked for beginners and some of them are games okay some of them are animations and some of them are like card games specifically or puzzles or mazes or encryption programs or something like that yeah in your list of of stuff you mentioned beyond going through just using the error system to find you know typos or bugs and and so forth of trying to run the code you you mentioned running it under a debugger and i recently had nina on to to talk about debugging mm-hmm nina zacharianico and we talked about you know using it across your different projects but i think this is a really nice time to introduce it especially for somebody who's a beginner intermediate person to have a small program to debug you know and walk through and see as the code is executing but also to also see you know okay what are the values of things as we're going along and so i think this is actually a nice combination of things to implement as you're going along and i i we we were talking about it that we feel like you know the print statement has always been the thing that has always been thrown out there in so many of the tutorials of python yes but a debugger is like such it's not that big of an additional step it's not that you know it's not like five times as difficult it's just like another little step in your path of learning python yeah i think nina had had a talk or something that was that was called stop printing start debugging something like that yeah yeah as uh goodbye print hello debugger yes yes that is that is a much snappier title than the one i had yes yeah it's good [Laughter] yeah yeah i i mean i i do talk about the debugger uh in the introduction chapter i mean looking back over it now i wish i went into far more detail about the how the debugger works and and even with my other books i've come to realize that really we should be teaching the the debugger a lot earlier than than we do currently usually like debugging is sort of like one of those things like documentation uh that's sort of put in at the very back of of the book but i feel like probably right after you introduce flow control like loops and if statements that would probably be the best time to to say and now here's how the debugger works don't don't be scared of it yeah yeah watch your stuff travel through those loops and structures and yeah i like that about that that's right yeah it's um it's one of those things that we you know once you've been programming for years and years you sort of forget that there was a time that you didn't know that um and the other thing that i i covered is just being able to type yeah i was gonna talk about that yeah and and basic text editor features yeah you you um there's like three things i want to talk about now i want to go back before we go into typing you you talk about okay modify it in ways that you think you know you could make it your own yes oh yeah are there other suggestions that you have about how should people experiment with this code i mean obviously you're not trying to you know set guidelines or rules behind it but are there suggestions that you're saying hey you know don't just leave this as it is like this is your chance to kind of make it your own are there other suggestions you you make for that oh yes yes i totally forgot about that yeah um and so also uh you know finally after after you've typed it in and you've created your own i just sort of encourage experimentation there are some places in some of these projects where i'll have a comment with a little exclamation point and i'll just say like hey try changing this to some other value or try commenting out the following lines of code and see how the behavior changes and that's just to help build up that sort of cause and effect between the what you've written in and what happens so each project also has like a small list of possible changes that you can make and then also um there's a section called exploring the program where i'll make suggestions for changes you can make and some of these suggestions will purposefully just crash the program but they will crash the program in an interesting way or just add like a really silly like infinite loop or some some like silly uh behavior from the program that is not correct but it is kind of fun to play with and that's a lot of that is also just to get rid of that intimidation factor of like oh no my program crashed yeah this can happen and you know don't don't be upset errors are your friends they're trying to tell you things yeah there's no way you can damage your computer by having your program crash i mean crash sounds kind of scary actually but really it just means the operating system decided to stop your program because it got an instruction it doesn't know how to do i had these atari computers back in the day um it was an atari st series and instead of like giving like a blue screen or whatever it would it would show a bomb when you crashed your computer and you could know like how like intense the crash was by the number of bombs that is like i know it was like oh that was a four bomb crash there it was pretty crazy oh man so yeah i don't know if that's that's a great icon for that but i always found that fascinating yeah yeah there's um it's it's something that i have to keep in mind i think uh when i started creating programs for scratch which is the uh the tool for the programming environment from mit for uh programming for kids uh usually ages like eight to twelve uh i think they recommend eight to sixteen but usually i see like 8 to 12 or 14 is is the ages that i see and they made a lot of great design choices for that and i also realized you know because the the website where you publish your programs is mostly for kids i started realizing like you know even having like mocking men's messages from a game like when you lose like you would say like haha you lose loser or something like that i sort of realized like oh or even some kids would point out it's like hey you know the game doesn't have to make fun of you just because you lost it it's actually fine to lose at a video game it's uh and then i started thinking like oh yeah why there is sort of a you build up this idea of like right i'm not just making programs for myself or some buddies right you know you have to sort of think like oh what does this look like to somebody who is not like you somebody who you know maybe english isn't their first language or they're a different age like much much younger or much much older than you or just you have some different cultural context yeah it doesn't translate always right right yeah yeah okay i i go into your typing thing i went to that first website you suggested and i don't i don't have written down oh yeah but i was like wow that's a really great online resource yeah i was impressed i i was actually for a while thinking about making my own typing tutor program and so i started doing a lot of research online and i and i realized how much better they are today because i also downloaded some older programs and and i think these were sort of like the older ones were sort of typing tutors made by programmers who didn't do any actual sort of pedagogical research or anything like that they would just be like sure oh these space aliens with a word are appearing and type the word to shoot them in right but like a lot of good typing programs i think just like typingclub.com and typing.com yeah yeah that was what i was checking out yeah typingclub.com and had like i didn't run the first uh evaluation thing or sort of looks at your level i haven't done that yet but i'm yeah probably going to this afternoon because i thought it was interesting i mean it's it's really nice because they'll have like a picture of the keyboard with transparent hands on it so that way and and they'll reiterate that the main rule that you should always follow in learning how to type is don't look at your own hands yeah and so if you need to know where a key is you can look on the screen and find it i thought like you know once once somebody shows you that you realize like wow that's a really good idea yeah why don't all typing programs have that sort of thing and and it is important because you know you don't need to be a fast typist to to be a programmer sure but it's one of those things where uh it's a minor frustration that you can get past when you have to like type out a bunch of code and then you realize you've you've mistyped it so you have to go back and change it around so you know having just getting beyond the hunt and tech stage of typing is really helpful and so this is also something that scratch was able to sidestep completely with their sort of snap together code blocks yeah yeah that makes sense yeah cause i realized this when i started teaching kids for a saturday morning programming class that uh well kids you know if you're nine or ten years old you don't necessarily know how to type and if anything you're just used to smartphones and tablets where you're uh tapping and they autocomplete yeah exactly and so not having that in scratch was was really great but now if you're moving on to python this is sort of when you should learn how to type you know not properly with fingers on the home row at all times but just be able to to type moderately well uh and you'll avoid a lot of you know slowdowns i guess yeah yeah there were like 600 something lessons i saw it was like crazy it really goes on i was wondering if i'd seen some other language typing tutor programs or whatever that were kind of geared for programmers where they really threw your hands into the you know the curly braces and other kinds of things and i'm wondering if that could be like the side module they could add to something oh wow yeah obviously wouldn't wouldn't be something they'd have initially but i i should suggest it because i think that would be good i mean not you know python has its own set of those but it would be good if you got your hands comfortable with you know finding those kinds of things the you know the hash mark and all those kinds of you know fundamental like you know symbols you use all the time right there's a there's a unix command line program called type speed all right that's one i think that was basically one of these one of these older typing programs but it mostly one of the word sets you can have is uh like unix commands okay and so it's you know the the letter frequency is much different from typing regular english and you also get used to just typing weird characters and you know uh io octal or um or just you know words like yeah you normally don't uh types there so that's also another thing [Music] this week i want to shine a spotlight on another real python video course i feel like it's really connected to this week's topic the course is designed to help you take your skills to the next level by building projects it's titled grow your python portfolio with thirteen intermediate project ideas the course is based on a real python article by habib and in the course darren jones takes you through the importance of building projects the major platforms you can build projects for it includes details for command line web and graphical user interfaces and has 13 different project ideas that you can work on along with multiple tips for working on those projects i think it's a worthy investment of your time to create projects that you can share with others and demonstrate your knowledge real python video courses are broken into easily consumable sections and include code examples for the techniques shown all lessons have a transcript including closed captions check out the video course you can find a link in the show notes or you can find it using the enhanced search tool on realpython.com [Music] so you had a few suggestions in your introduction also about ides and you kind of uh centered initially on on the mu editor i'm thinking that's how it's pronounced yes and uh why do you like that one so originally i i really liked idle which is the ide that comes with python because it's it's simple yeah it's really simple it's just sort of a bare bones editor and i think having an editor bundled with with python is a phenomenal idea because then you you know you don't have to have people learning how to use text editors and then learning how to use the command line so that they could run python with their their file or something it's it's a lot easier but it's uh i did have some ideas for how idol could be improved and and i wrote up a a bunch of them and then the the creators of mew sort of implemented a lot of those same ideas turns i found out about mew at uh from a pycon video and sort of things like uh tabbed tabs for each of the files and a separate pain that's still attached well a pain that is attached to the main window that shows the output yeah currently idle has the file editor window and then the interactive shell window but they're separate windows and a really common thing that beginners send me emails about is they don't know how to run their code because they're either entering code into the file editor when they wanted to put it into the interactive shell or vice versa and the only thing that i can really say because they look so similar to each other is like well the interactive shell has the three angle brackets for the prompt yeah just look for that but yeah at the same time though there are people who are um comfortable enough just moving into something like visual studio code pycharm pycharm the community edition for that and uh and i tell people like these are great don't don't worry too much about the really complicated looking interface that has you know 80 of those features you're not even going to use your first year basically yeah and and those are nice too because they also have the debugger built in with them yep yeah which is very powerful yeah and and just on top of typing i also go into how do you edit text uh because i realized there's there's a lot of things i do just sort of like hitting ctrl a well like knowing the keyboard shortcuts like for copy and paste and select all yeah or holding down shift and then pressing end so that you highlight the rest of the line yeah those are so powerful yeah and and they're they're all sort of things i just do naturally at this point because i've been doing them for so long but again i forget what i didn't know when i first started out and you can see this immediately with when you're teaching somebody to program and you know they're doing things like you know pressing space several times instead of tab a couple times yeah i i i was teaching at a law firm i was like basically to teach them all to use you know the software that they were practicing but one of the main things i ended up doing is doing like classes on on word actually because they all used it and all their documentation was in word yeah and so a lot of times it was like okay let's do some of the things you're just talking about like yes you can click once to put your cursor in but you know if you double click on on a word it selects the whole word or if you triple click it'll select the entire line and most people were like what you know like they you know have never seen that and then the things that you're talking about like the combinations of of shift and you know control and arrows and you know selecting entire lines or you know stuff like that that are such fundamental things that really can you know especially if you know this is a person who is working with text all day yeah and you you maybe just sped them up drastically you know with lots of little things like that and um i think those things being unlocked early are such great things for programmers to know yeah and and we never sit down and and teach anyone yeah these things usually uh even even when we're like here's how to learn how to use a computer it's usually about how to browse the web and check email right but uh i think corey doctorow wrote an article in wired maybe like 20 years ago where he said he was talking about a study where the they found out that about 95 percent of people don't know about control f like that you can just press ctrl f and then it'll open up a little dialog to where you can find text yeah like enter text that you want to find and just let you know something that seems really basic but at the same time most people don't know about it you know if they if they need to find a word or a name or something in a web page or in a document they just manually scroll through and and just scan with their eyes and so there are people who you know they would show like hey let me show you this thing ctrl f and they would say oh my god you've saved me years of my life from this one little thing absolutely yeah yeah solely exactly you know and then you can like tell it how you want to replace things and yeah this these little things like again kind of the introduction to the magic yeah so this introduction i i try to fit in a lot of these things just you know about like here's how to copy paste here's how to type here's how to use you know write the code in the book and here's how to use the debugger but still the the introduction isn't that long i i wanted to keep it short but uh i sort of realized like wow this could probably be half the book if if i wanted it yeah to be but yeah but the rest of the book then is is just sort of you know you don't have to read it front to back you can just sort of uh flip through it and then see the projects that you find interesting yeah i want to talk about a few of the projects but i want to mention one other thing that you included that i think's really kind of neat which is the online diff tool that you added yes yeah so this is another thing so the diff tool is is often used for submitting patches or just showing changes between two versions of sort of the same bit of text this really helped me out when because people would email me saying like hey my program doesn't work right and from my earlier books and i realized i could cut down on a lot of those emails if i just had some sort of like online diff tool where they can copy and paste their code into my website and then click a button and it'll immediately show all the lines of code that are different from the code that's in the book and this you know this was really helpful it doesn't have to be completely perfect like some white space can be off and it's fine or like they didn't type the comments sorted by the extra lines or something yeah but it would also point out like hey yeah you typed a comma here when you wanted to put a period uh something that you know you could look at the error message but you know when you're a beginner the error messages don't really make a lot of sense and so you tend to tend to ignore them but like minor little things like that that could just really you know kind of well mostly save time and emails being sent to me fixing people's code totally but yeah that's that's another uh idea that i that i learned uh when teaching people how to program is you know all these minor mistakes where once you have years of experience they don't really faze you at all because you're sort of used to it's like oh yeah this error mess just comes up let's try this or or even you know now is the time to turn it off and turn it back on again um to magically fix it yeah so what were what were some of the projects that you were most eager to share okay so i'm looking through a lot of these and and i realized that i according to the get repo that i started i think i first started making these in 2018. okay i wanted to create a bunch of small games that only used print and input and didn't have graphics but they were still fun yeah like 2048 is like a great yeah exactly that's that tile sliding game where you try to combine powers of two the the lucky programmer numbers yeah and so i realized hey that's something that doesn't you know it has graphics but at the same time you can recreate that with ascii art just using the lines and dashes those text characters to draw out the boxes right and things so 2048 is is on there i just have like some pretty classic programs like guess the number or rock paper scissors these are usually uh programs that you peop that are that feature in a lot of beginner tutorials yeah and then i also try to have like a slight twist on them like i have rock paper scissors as project 59 and then project 60 is rock paper scissors except you always win which is a slightly simpler program really but it looks the exact same except the player is always winning and the the idea is like yeah just hand this off to your friends and show them this and see how long it takes for them to figure out that they can't possibly lose at this game like 99 bottles uh is another program that's really common in a lot of beginner tutorials because it has you know you get an introduction to loops and you just have it print out the the lyrics of the song 99 bottles of beer on the wall so that's project 50 and then project 51 is an alternate version of that where you start introducing slight changes and deformities to the text like it'll it'll replace a character with a blank or it'll double a character or it'll swap it'll transpose two characters uh each time it prints out the stanza so as the song continues to print out more and more it starts looking more and more like you just got progressively more drunker as you were singing it but um yeah there's there's a lot of board games that i have uh mancala is is one um i had a checkers program that was going to get into this book but i had to cut down on on the content for that there's some science and math programs i have a periodic table of the elements and also um nice something that generates the multiplication table something that can find factors or prime numbers or do the uh the kalats sequence which is also known as the three x plus one uh problem it's often called the simplest impossible problem in mathematics uh that's that's in there and then i have a lot of different visualizations a lot of these uh visualizations sort of just take advantage of the fact that as you print more and more lines of text to the screen it'll start the screen will start scrolling that text up and so i started making these small little like animations like those old screen savers that all uh scroll upwards so i have one that just shows sort of like a winding uh river i call it deep cave because when i first made it i thought like oh it's like a cave going deeper and deeper into the earth and then only after the book was published it was like it would have been a lot better if i just called that a river um but um something that yeah i like the dvd logo yes oh yeah that's that's one where uh that also kind of dates me i i feel like but um but it'll have yeah it'll have a like the little dvd text that just bounces around diagonally around the screen and then it'll also keep count of how many times it hits the corner exactly but uh there's there's a visualization of dna just the double helix that just repeats and then also i have the the matrix screensaver where you know instead of just like the green numbers and kanji characters yeah scrolling down it just has ones and zeroes but of course they're also scrolling up but it's a very similar effect and so that's that sort of describes a lot of these programs it's like oh hey it's like this thing except much much simpler yeah i think they're great jumping off points too for people to i don't know it kind of brings me this idea of like the idea of finishing things yes small things yes and what that promotes in developers you know i i think that that's a huge deal because you know i'm definitely one of those people that i i start a lot of things so i like this idea of like let's let's finish some things together you know small things like what are your thoughts on that i mean that was one of the big motivations for me working on these is because you know i would have these projects that are like okay i can have this done in like four or five months yeah and it turns out actually that was wildly optimistic and it was this project that wasn't really for other people was just something that i was working on and and so i started falling back on th
Original Description
Are you a beginner or intermediate Python programmer who has made it through some of the fundamentals? Have you tried to tackle a big project but got stuck and frustrated? Completing some small projects might be the answer. This week on the show, we have author Al Sweigart and talk about his new book, "The Big Book of Small Python Projects."
👉 Links from the show: https://realpython.com/podcasts/rpp/77/
We discuss the advantages of sometimes thinking small in terms of Python programs. We talk about completing projects and the benefits of manually copying code by typing it in yourself. Al also has suggestions about tools for beginners and intermediate developers.
Topics:
- 00:00:00 -- Introduction
- 00:01:53 -- Writing books and PyCascades 2021 Author panel
- 00:06:58 -- Did you type in code from books as beginner?
- 00:10:16 -- About the book
- 00:20:53 -- Sponsor: Rev AI
- 00:21:30 -- General instructions on how to start with the book
- 00:27:39 -- Working with a debugger
- 00:30:28 -- Experimenting with existing code
- 00:34:27 -- Tools for learning touch typing
- 00:38:31 -- Video Course Spotlight
- 00:39:37 -- IDEs, Mu, and Python's IDLE
- 00:45:42 -- Online diff tool
- 00:47:27 -- Some of the projects, games, animations
- 00:51:58 -- Finishing things
- 00:54:07 -- What are areas of Python you see beginners struggle with?
- 00:59:41 -- What is something you wish you were shown as a beginner?
- 01:02:07 -- What are you excited about in the world of Python?
- 01:04:34 -- What do you want to learn next?
- 01:07:27 -- Shout outs and social connections
- 01:08:33 -- Thanks and goodbye
👉 Links from the show: https://realpython.com/podcasts/rpp/77/
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Real Python · Real Python · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
A better Python REPL – bpython vs python interpreter
Real Python
Introducing large-type.com – A Utility Website
Real Python
Reading Hacker News Without Wasting Tons of Time
Real Python
Forward References and Python 3 Type Hints
Real Python
Using Sublime Text as your Git Editor
Real Python
Python Code Linting and Auto-Complete for Sublime Text
Real Python
Make your Python Code More Readable with Custom Exceptions
Real Python
Write Better Tests with Sublime Text's Split Layout Feature
Real Python
How to Use Sublime Text from the Command Line
Real Python
Rename Variables with Multiple Selection in Sublime Text
Real Python
Sublime Text Settings for Writing PEP 8 Python
Real Python
Write Cleaner Python with Sublime Text's Indent Guides
Real Python
Sublime Text Whitespace Settings for Python Development
Real Python
Function Argument Unpacking in Python
Real Python
Python Code Review: Debugging and Refactoring "Conway's Game of Life" + Automated Tests
Real Python
Using "get()" to Return a Default Value from a Python Dict
Real Python
A Python Shorthand for Swapping Two Variables
Real Python
Python Code Review: Refactoring a Web Scraper, PEP 8 Style Guide Compliance, requirements.txt
Real Python
Click & Jump to Test Failures from the Command Line (iTerm2)
Real Python
Setting up Sublime Text for Python Developers
Real Python
Sublime Text + Python Guide Overview
Real Python
Python Code Review: Adding Pytest Tests to an Existing Python Web Scraper
Real Python
Type-Checking Python Programs With Type Hints and mypy
Real Python
A Shorthand for Merging Dictionaries in Python 3.5+
Real Python
Python Code Review Flask Web Security Tutorial + Virtualenvs, requirements.txt
Real Python
My Python Code Looks Ugly and Confusing – Help!
Real Python
Setting Up a Programmer Portfolio/Developer Blog – How To Get Started
Real Python
Do I Need a GitHub/GitLab/Bitbucket Profile as a Developer?
Real Python
Programmer Portfolio – Example and Walkthrough
Real Python
How to Get Your 1st Speaking Gig at a Tech Conference
Real Python
How to Build Your Public Speaking Skills as a Developer
Real Python
The Object-oriented Version of "Spaghetti Code" is "Lasagna Code" ?!
Real Python
Setting up Sublime Text for Python Developers – Lesson #1
Real Python
Cool New Features in Python 3.6
Real Python
"is" vs "==" in Python – What's the Difference? (And When to Use Each)
Real Python
Emulating switch/case Statements in Python with Dictionaries
Real Python
Python Function Argument Unpacking Tutorial (* and ** Operators)
Real Python
What Code Should I Put On My GitHub/GitLab/BitBucket Profile?
Real Python
A Crazy Python Dictionary Expression ?!
Real Python
String Conversion in Python: When to Use __repr__ vs __str__
Real Python
Method Types in Python OOP: @classmethod, @staticmethod, and Instance Methods
Real Python
Optional Arguments in Python With *args and **kwargs
Real Python
Python Context Managers and the "with" Statement (__enter__ & __exit__)
Real Python
Installing Python Packages with pip and virtualenv / venv
Real Python
"For Each" Loops in Python with enumerate() and range()
Real Python
Python Code Review: LibreOffice Automation and the Python Standard Library
Real Python
Managing Python Dependencies With Pip and Virtual Environments – Lesson #1
Real Python
Python Tutorial: List Comprehensions Step-By-Step
Real Python
Leveraging Python's Implicit "return None" Statements
Real Python
What's the meaning of underscores (_ & __) in Python variable names?
Real Python
Python Data Structures: Sets, Frozensets, and Multisets (Bags)
Real Python
Writing automated tests for Python command-line apps and scripts
Real Python
How to find great Python packages on PyPI, the Python Package Repository
Real Python
Immutable vs Mutable Objects in Python
Real Python
PyPI vs Warehouse, the Next-Generation Python Package Repository
Real Python
pep8.org — The Prettiest Way to View the PEP 8 Python Style Guide
Real Python
My Experience at PyCon 2017 in Portland
Real Python
Pylint Tutorial – How to Write Clean Python
Real Python
"Reverse a List in Python" Tutorial: Three Methods & How-to Demos
Real Python
Python Refactoring: "while True" Infinite Loops & The "input" Function
Real Python
More on: Prompt Craft
View skill →Related Reads
📰
📰
📰
📰
Mastering the Art of Writing: Effective Techniques for Freelance Writers
Dev.to AI
Your site gets six words to convince me. It just used five of them to say nothing.
Medium · SEO
5 Copywriting Tricks Hidden Inside Warren Buffett’s Shareholder Letters
Medium · Programming
Si tu fais Du Copywriting Arrête d’écrire. Parle.
Medium · SEO
🎓
Tutor Explanation
DeepCamp AI