How To Write Better Python Code
3 min readJul 23, 2022
Welcome back! Python is one of the most important programming languages out there, if you’re new to it, check out the link below to learn more about it:
So, let’s take a look at some ways to write better Python code!
Comment Comment Comment
Another important way to keep your code clean is by commenting out your code, most of the time, my project consists of more comments than code (which is probably why i’m a terrible programmer 😂). Comments help keep your code clean by explaining what those blocks of code do, but it can also double as separating different portions of your projects.
quantityofitems = 12
name = 'tom'
totalcost = 1234print("total of " + name + "order is" + totalcost)
When we comment, it can help explain what we’re doing with our project:
#GETTING THE QUANTITY OF ITEMS
quantityofitems = 12#NAME OF CUSTOMER
name = 'tom'#TOTAL COST OF ORDER
totalcost = 1234