Areas for Improvement - Week 28

You can't more to where you want to go if you don't know where you are or what direction to head in. With this in mind here are a few areas for improvement that I am working on:


Clever Programmer published a useful video this week on Why Being Faster will Make you More Money. I would tend to agree with him, it makes logical sense that if you can work with more speed, without sacrificing precision, then you will be more effective in what you do. In this video he mentions the website Nitro Type Race  I have played this a couple of times now and I have found it an enjoyable way to practice my typing speed. My current speed is about 50 wpm so there is a lot of room for improvement. I have decided to go to this website at least once a week to increase my typing speed in the long run.

Navigate the OS with Terminal

Up until last week I have been using the Finder window to drag and drop to where I want to be within terminal. I have been doing this with the misunderstanding that this is more efficient than navigating to a folder within the terminal window. It has been pointed out to me by my Python mentor that this isn't more efficient. The effect has also been that I am not as comfortable in the terminal window. When I paused to think about it, I realised that he was right. I am not used to navigating to a folder without going to Finder to drag and drop the folder path into terminal and so I have to think a lot more when I am within terminal. When I wasn't using terminal to navigate to folders I found that it was hard for me to visualise where exactly I was in the terminal and how I could navigate to the folder I wanted to be in. I also was using less terminal commands less frequently, commands like ls to list the contents of a folder and  cd with the folder path to navigate to a folder. As a result these commands are less likely to be in my muscle memory and automatic way of thinking.

Python Functions within Flask

One of the key areas I am currently struggling to come to terms with is incorporating a self contained Python function within a Flask app. This week I have been working on incorporating an API into my Flask app. I have chosen to work on a Google Maps integration. I followed a few videos on Youtube which showed me how to create the following Google Maps API script:

This script works exactly how the videos show but when I go to incorporate it into my Flask app I run into a few issues. First of all the function needs to be split because the input comes from a form in a html file rather than from the address variable within the function. I find that this takes a bit of getting used to as my focus and attention are automatically split across a wider area.

In the Flask app the Python function is written in an file below:

The input comes from the user within a form on the google_maps.html file:

Return, Print issue

In my original Python function on GitHub you will notice that there are a few places where the print statement is used. These statements provide some extra detail to the user like the API Status. The function returns the following result:

The issue with my function in Flask is that I can't use the print statement within the function to add more details. Instead I need to assign the answer to a variable called result that will then print the answer to the screen using the corresponding {{result}}, see Jinja2 templating, variable on the google_maps.html page

So there you have it, the key areas I am working through on Week 28 of my Python learning journey. If you have an insights, recommendations or questions then feel free to leave a comment or send me an email.