Let’s say that you have a Python string, and want to grab a substring from it. The best way to do so is with a “slice”: >>> s = ‘abcdefghij’>>> print(s[3:8])defgh In the above code, we’ve defined a string. We’ve then asked for the string to be returned, starting at index 3 and up to…
For more than 20 years, I’ve been teaching Python courses to companies around the world. This means that just about every day, I’m on the front lines of Python learning. I see, first-hand, what companies want people to learn and also what people are struggling to understand. The result is Weekly Python Exercise, my course…
I’m a professional trainer; just about every day, I’m in a different city, country, and/or company teaching Python, data science, and other topics. Over the last few years, I’ve also thought a lot about training as a specialty — and I write about it on my “Trainer Weekly” newsletter, as well as in a “Technical…
Every so often, I’ve asked readers of my free, weekly “Better developers” newsletter to send me their Python problems. And every so often, I get a chance to answer their questions, going through their Python problems and trying to solve them. I’ve recently recorded and uploaded two videos with solutions to their problems, which I’m…
Let’s say that I want to write some Python code that invites the user to enter a number, and then prints that number, tripled. We could say: >>> n = input(“Enter a number: “)>>> print(f”{n} * 3 = {n*3}”) The good news is that this code works just fine. The bad news is that it…
One of the first things that anyone learns in Python is (of course) how to print the string, “Hello, world.” As you would expect, the code is straightforward and simple: print(‘Hello, world’) And indeed, Python’s “print” function is so easy and straightforward to use that we barely give it any thought. We assume that people…
If you want to join this month’s cohort of Weekly Python Exercise, you’d better act fast: Registration ends today! If you feel stuck after having taken a Python course or read a book, and don’t know how to improve, If you want to get real-world practice problems that’ll help you with your career, If you…
If you want to improve your understanding of Python, then you’re going to have to practice. And as hundreds of developers from around the world have already learned, there’s no better way to practice than Weekly Python Exercise. If you’re relatively new to Python, this our upcoming cohort is for you! Weekly Python Exercise: Newbie…
Python is one of the hottest languages out there. People can’t get enough Python, and companies can’t get enough Python people. This means that learning Python is a great move for your career. (Also, it’s just plain ol’ fun to use.) If you’ve always wanted to get started with Python, or if you’ve been using…
[Construction notice: I’m rewriting this article to reflect the (bad) situation for foreigners using WeChat, and the (amazingly good) situation for foreigners using AliPay. I hope that the rewrite will be done by soon, but covid-19 has made my schedule even more unpredictable than before. My apologies for the verbal dust that’ll be around until…