Python in Everyday Life

Jesse, Mon 28 December 2020, Learning

homework, learn by doing, schools

I've been learning Python for 6 to 7 months now, and have really enjoyed it. Slowly but surely, I am finding ways to incorporate what I have learned in Python and other things such as Git, terminal usage, etc., into my every day life.

The most recent example came when I was helping my daughter with her homework!

My daughter had a homework assignment called Magic Squares. If you are not familiar with them, a Magic Square is typically a three by three grid (similar to Tic-Tac-Toe), in which each of the directional rows or columns (vertical, horizontal, and diagonal) all have the same sum.

Due in part to the pandemic, she was assigned to do this in Google Classroom via a Google Slide.

The slide was not well prepared, and it was very difficult to place her answers into the correct boxes.

Me being me, I thought, "hey, this is a GREAT opportunity to use Python!" I thought about this in part because I had already made a Tic-Tac-Toe game in the past, and I already had a sample grid ready.

All we had to do was populate it with the values from her homework assignment and then fill her answers into the empty squares. I was able to do this using some string manipulation, i.e. converting the strings into lists to make changes and then back to strings again.

Long story short, I ended up using my newfound knowledge of Python, Git, and terminal commands to quickly create a file for her, write to the file with her answers, and send it via email to her teacher. The code is here.

All of this was completed in about twenty to thirty minutes, and the majority of that time was spent fixing each grid to match the initial state of each problem that she had.

This is a small example of the usefulness of Python in everyday life, but it has come in handy in other situations as well, such as having to parse a Rich Text File full of baby shower invitees for my wife.

I love learning more about Python and developing/computer science in general, and I can honestly say that I would not know nearly as much as I currently do without the great Bites from PyBites. Thanks, Bob and Julian, for creating such a rich environment to learn in. Your expertise is greatly appreciated!

Keep calm and code in Python!

-- Jesse

PyBites Python Tips

Do you want to get 250+ concise and applicable Python tips in an ebook that will cost you less than 10 bucks (future updates included), check it out here.

Get our Python Tips Book

"The discussions are succinct yet thorough enough to give you a solid grasp of the particular problem. I just wish I would have had this book when I started learning Python." - Daniel H

"Bob and Julian are the masters at aggregating these small snippets of code that can really make certain aspects of coding easier." - Jesse B

"This is now my favourite first Python go-to reference." - Anthony L

"Do you ever go on one of those cooking websites for a recipe and have to scroll for what feels like an eternity to get to the ingredients and the 4 steps the recipe actually takes? This is the opposite of that." - Sergio S

Get the book