The Invent with Python Blog

Writings from the author of Automate the Boring Stuff.

Python's Fake Increment and Decrement Operators

Mon 21 May 2018    Al Sweigart

In Python, you can increase the value of a variable by 1 or reduce it by 1 using the augmented assignment operators. The code spam += 1 and spam -= 1 increments and decrements the numeric values in spam by 1, respectively.

Other languages such as C++ and Java have the ++ and -- operators for incrementing and decrementing variables. (The name of C++ itself reflects this; the name is a tongue-in-cheek joke that indicates it's an enhanced form of the C language.) Code in C++ and Java could have ++spam or spam++. Python wisely doesn't include these operators; they are notoriously susceptible to subtle bugs.

Read more...



How To Ask For Programming Help

Fri 02 February 2018    Al Sweigart

I often get emails say little more than "Why doesn't my program work?" Often I can't answer them; either I don't have enough information about your problem or you're asking me about something I don't know anything about.

Read more...


Lessons Learned from Creating a Udemy Course

Wed 05 April 2017    Al Sweigart

This post contains the lessons I've learned and my process for creating video tutorials, and I hope others who want to do the same find it useful. While this post is specific to Udemy and programming courses, the same lessons probably apply to all online courses.

Read more...












IDLE Reimagined

Thu 20 November 2014    Al Sweigart

IDLE Reimagined is the project name for a redesign for Python's default IDLE editor with focus as an educational tool. IDLE's chief utility is that it comes installed with Python, making it simple for newbies to start programming. But professional software developers don't use IDLE as their IDE. Instead of turning IDLE into a sophisticated IDE for professional software developers, it can be tooled with features specifically to make it friendly to those learning to program.

Read more...


No, Seriously, Why Should I Learn to Code?

Tue 30 September 2014    Al Sweigart

The geeks have inherited the earth. A couple decades ago if you talked with friends in a chat room, you were cast as a socially-awkward nerd. Doing the same today just means you're a typical Facebook user. Broadband Internet connections and smartphones have taken the Information Age that technically started in the 1970s with PCs and pushed it into daily mainstream life.

Don't get me wrong: You should learn to program. But lost in this hype is a plainspoken reason: NO, SERIOUSLY, WHY SHOULD I LEARN TO CODE?

Read more...



Why Is HTML Not A Programming Language?

Sun 15 December 2013    Al Sweigart

HTML is not a programming language. You can't write a "program" that, say, calculates the average of ten numbers with HTML. While some may point out that HTML is a "markup language", this doesn't clarify how that is different from a programming language. This isn't meant to be a thorough argument, but rather a brief explanation that goes just a bit more in detail than "HTML isn't a programming language but instead a markup language."

Read more...