Tag Archives: Python

Python 101 – Working with Strings

You will be using strings very often when you program. A string is a series of letters surrounded by single, double or triple quotes. Python 3 defines string as a “Text Sequence Type”. You can cast other types to a string using the built-in str() function.

In this article you will learn how to:

  • Create strings
  • String methods
  • String formatting
  • String concatenation
  • String slicing

Let’s get started by learning the different ways to create strings!

Continue reading Python 101 – Working with Strings

PyDev of the Week: Pablo Galindo Salgado

This week we welcome Pablo Galindo Salgado (@pyblogsal) as our PyDev of the Week! Pablo is a core developer of the Python programming language. He is also a speaker at several Python related conferences. If you’d like to see what projects he is contributing to, you can check out his Github profile.

Let’s spend some time getting to know Pablo better!

Can you tell us a little about yourself (hobbies, education, etc):

I am currently working at Bloomberg L.P. in the Python infrastructure team, supporting all our Python developers and providing critical infrastructure and libraries to make sure everyone has better experience programming in Python. But before working on the Software industry I used to be in academia as a theoretical physicist researching general relativity and in particular, black hole physics. This is something that I still do as a hobby (although without the pressures of publication and funding) because I still love it! For instance, I have given some talks in some Python conferences related to this
(https://www.youtube.com/watch?v=p0Fc2jWVbrk) and I continue developing and researching improved algorithms to simulate and visualize different spacetimes. For example, here you have some simulated Kerr Newman black holes with accretion disks around them I have worked on recently:
Continue reading PyDev of the Week: Pablo Galindo Salgado

Python 101 – Learning About Dictionaries

Dictionaries are another fundamental data type in Python. A dictionary is a key, value pair. Some programming languages refer to them as hash tables. They are described as a mapping object that maps hashable values to arbitrary objects.

A dictionary’s keys must be immutable, that is, unable to change. Starting in Python 3.7, dictionaries are ordered. What that means is that when you add a new key, value pair to a dictionary, it remembers what order they were added. Prior to Python 3.7, this was not the case and you could not rely on insertion order.

You will learn how to do the following in this chapter:

  • Create dictionaries
  • Access dictionaries
  • Dictionary methods
  • Modifying dictionaries
  • Deleting from your dictionary

Let’s start off by learning about creating dictionaries! Continue reading Python 101 – Learning About Dictionaries

PyDev of the Week – Abigail Mesrenyame Dogbe

This week we welcome Abigail Mesrenyame Dogbe (@MesrenyameDogbe) as our PyDev of the Week! Abigail is active with the PyLadies organization in Africa and has also helped organize PyCon Africa. Abigail is also a fellow of the Python Software Foundation.

Abigail Dogbe

Let’s spend some time getting to know Abigail better!

Can you tell us a little about yourself (hobbies, education, etc):

I worked with the Internal Audit Department at the Ghana Community Network Services Limited (GCNet) after obtaining a BSc in Computer Science and Engineering from the University of Mines and Technology in Tarkwa, Ghana. Growing up, I struggled with Mathematics and did lots of drawings, paintings, and singing during my hobbies. My hobbies became numerous as I matured so much that I no longer make drawings and paintings but I’ve found happiness in playing with African beads to make accessories and I still sing a lot, although mostly to smaller groups or to myself.

I have a great interest in sports such as volleyball, football and swimming as well. During my final year at the university, I was elected as the captain of the women’s volleyball team. We had lots of training sessions and won a few matches. I am actually impressed with how far the team has come after I completed school.

Also, I have a keen interest in Tech Community Building and I find joy in helping others grow in their career. Continue reading PyDev of the Week – Abigail Mesrenyame Dogbe

Python 101 – Learning About Tuples

Tuples are another sequence type in Python. Tuples consist of a number of values that are separated by commas. A tuple is immutable whereas a list is not. Immutable means that the tuple has a fixed value and cannot change. You cannot add, delete or modify items in a tuple. Immutable objects are useful when you need a constant hash value. The most popular example is the key to a Python dictionary.

In this article, you will learn how to:

  • Create tuples
  • Work with tuples
  • Concatenate tuples
  • Special case tuples

Let’s find out how to create tuples! Continue reading Python 101 – Learning About Tuples

Stuck at Home Python Book Sale

Python is one of the most popular languages in the world. I have been using it myself for over a decade and am still constantly learning new things.

Since so many people are stuck at home, I thought it might be a good time to do a book sale. Now is great time to learn Python or learn a new skill using Python.

With that in mind, I have all my books for sale. Just use the special links below to get the sale price:

There are free chapters available at each of the links. You can download the sample by clicking on the Read Free Sample button on the left.

Feel free to ask me any questions you might have about the books.

What’s New in Python 101 2nd Edition

The original Python 101 was the first book I had ever written. In deciding to write a 2nd edition, I needed to decide what I should keep and what I should remove from the book. What I ended up doing was rewriting the book from the ground up.

Python 101 2nd Ed Kickstarter

In the original book, Python 101 was based on Python 3.5 and had the following sections:

  • Part I – Learning the basics
  • Part II – Learning from the library
  • Part III – Intermediate Odds and Ends
  • Part IV – Tips, tricks and tutorials
  • Part V – Packaging and Distribution

For the 2nd edition, I am dropping part II as most of that information can be covered in later chapters. Now that Python 3.8 is out, I am able to cover such things as

  • f-strings
  • assignment expressions
  • dictionaries being ordered by default
  • type hinting
  • source control
  • review questions for most chapters
  • and more!

And mention other neat things, like sub-interpreters, the futures module, and audit hooks, although those won’t be covered in detail. I am also planning on making the tutorials section into a more proof-of-concept section where you will have little useful scripts that you can take and use. That was already there to some degree, but I think these scripts will be even better than the original ones.

The distribution section will also get a makeover to cover the latest conventions for distributing your code to the Python Packaging Index. The original book’s coverage is out of date.

Also while the first book mentioned lots of different options for creating executables, the new version of the book will focus on only one or two, but it will show how to create a binary for Windows and Mac. I am investigating how to support Linux, but that may or may not be included.

I will be making quite a few chapters available in the free sample available on Leanpub so people can check it out before purchasing.

I hope you’ll check out the book. Feel free to ask questions in the comments or send me an email.

Python 101 2nd Edition will be released in September 2020

Python 101 2nd Edition Kickstarter Ending in Two Days

My Kickstarter for the 2nd Edition of Python 101 is ending in less than two days. If you want a signed copy or to purchase one of my other books for a discount, you should check out the Kickstarter as I have lots of good deals on there.

Python 101 2nd Ed Kickstarter

Also, note that the 2nd Edition of Python 101 is a complete rewrite. This book will have all new content and is on track to be one of my longest books. I think you will really like it if you are a beginner learning Python or someone who has been using Python but would like to improve to the next level.

PyDev of the Week: Jessica Garson

This week we welcome Jessica Garson (@jessicagarson) as our PyDev of the Week! Jessica is a developer advocate at Twitter. She also teaches Python at New York University. You can see some of what she’s up to over on Github. Let’s spend some time getting to know her better!

Can you tell us a little about yourself (hobbies, education, etc):

I’m currently a Developer Advocate at Twitter, where I work to make sure developers have good experiences using the Twitter API. What that means is that I write example code, speak at conferences and create blog posts. I also make noise music with Python and perform regularly in the New York area under the artist name, Messica Arson. Before working in technology, I worked on political campaigns.

Jessica Garson

Continue reading PyDev of the Week: Jessica Garson

PyDev of the Week: Tommy Falgout

This week we welcome Tommy Falgout (@lastcoolname) as our PyDev of the Week! Tommy works on the Robo-Clippy project. You can see what else he is up to by checking out his website. Let’s take a few moments to get to know Tommy better!

Can you tell us a little about yourself (hobbies, education, etc):

I grew up in the bayous of Louisiana, and while everyone else was interested in 4-wheeling and hunting, I gravitated towards computers and spent hours on my Commodore 64.  Early on, I knew what it meant to be an outcast.
As I matured, my hobbies became numerous and varied, but all focused around my passion of building.  For 5 years hosted and competed in Dallas/Fort Worth’s annual trebuchet competition: Slingfest, and was even featured on an episode of Dude Perfect on Nickelodeon as a Trebuchet expert (complete with my own IMDB page!).  I also volunteer at a local Makerspace in Plano, TX (TheLab.ms), built a LEGO Robotic Clippy and competed in the Red Bull Soapbox Derby race.  After a few exciting near-misses from bodily harm, I’ve settled down and recently taken up crochet and hobby electronics.

Continue reading PyDev of the Week: Tommy Falgout