How to Use Print for More Efficient Code

Here’s a quick tip that will help make your Python code way more efficient if you’re not already taking advantage of it. If you want to print all the values in a list separated by a comma, there are a couple different ways you can go about doing this: there are complicated ways, and then […]

Read More

How to Merge Lists in Python

If you ever have multiple lists in Python that you want to combine in one list, don’t panic. Python actually makes it really easy to perform a function like this. You can combine and concatenate lists just by using the plus (+) symbol — seriously, it doesn’t get much easier than that. If you want […]

Read More

Using Python’s Random Module to Generate Integers

In Python, the random module allows you to generate random integers. It’s often used when you need to a number to be picked at random or to pick a random element from a list. Using it is actually really straightforward. Let’s say you want to print a random integer within a given range, like 1-100. Here’s how […]

Read More

Python Basics: Strings and Printing

Strings are a really commonly used type in Python, and can be formed simply by placing quotes around characters. Anything that resides inside of quotations is a string (single quotes or double quotes are both acceptable). To create a string, you simply need to assign these characters inside quotes as values to a variable, like this: […]

Read More

Python Resources: Training Videos

Sometimes the best way to get acquainted with a new language or a new technique is to watch someone else do  it first, and then jump in to try for yourself. If you like to learn that way and are wanting to improve your Python skills, check out any of the training videos or video […]

Read More

Python Resources: Books

Everyone learns in different ways, and while some developers prefer to learn new coding languages interactively, others might appreciate having a solid foundation in the language before trying to write any code. If you’re looking to learn Python and like to learn new languages by reading books, check out the list below for some recommendations. 1. […]

Read More

Python While Loop

The while loop in Python is basically just a way to construct code that will keep repeating while a certain expression is true. To create a while loop, you’ll need a target statement and a condition, and the target statement is the code that will keep executing for as long as the condition remains true. The syntax […]

Read More

Using Sparts to Write Python Code

Sparts is a Python library developed by Facebook to eliminate skeleton code. The main purpose of the library is to make it easy to implement services without having to write excess code, so you can create prototypes really quickly. To learn the basics of Sparts, be sure to read the documentation. The way that Sparts […]

Read More

Python’s Count Method

In Python, the count method returns the count of how many times an object occurs in a list. The syntax for the count method is really straightforward: list.count(obj) The above example represents the basic syntax for this method. When you’re using it in context, you’ll need to replace the ‘list’ keyword with the actual name […]

Read More

Python Tools: Pyflame

Pyflame is new a tool brought to us by Uber’s engineering team (you can read about the conception of the idea here) that many Python coders will find very useful. The tool is used to generate flame graphs for Python processes.   Pyflame works by using the ptrace(2) system call to analyze the currently-executing stack trace […]

Read More