Goals for Today
I still want to do more list comprehension exercises. Hopefully I can find some that are more advanced. Google is my friend, hopefully.
I want to figure out how to get VS Code to auto-format my Python code.
What I Learned
I got a little distracted today playing with the CSS on my blog. Headers had too much spacing around them. With some research, I added this CSS to the appearance section of my WordPress blog:
Summary: My CSS knowledge is very limited. Fortunately there are lots of great resources available to help when needed.
Auto-formatting Python in VS Code
This wasn’t on my goal list for today but it was frustrating me that I couldn’t auto-format my Python code like could in PyCharm.
The solution was found here.
These are the settings I changed to get VS Code to auto-format my Python code:
"editor.formatOnSave": true` "python.formatting.provider": "autopep8"
Summary: I continue to be impressed with VS Code, particularly all the options available in it.
I came across this great animation that is perfect for demonstrating how list comprehensions are assembled:
This site helped me tremendously with flattening and recreating matrices:
This site helped me add the individual elements of each list:
With these resources I was able to make great progress on my Day 2 challenge but it’s not quite finished yet. It will add matrices with sub-lists of len=2 but not others. I’ll work on that next day…
View my updated Jupyter notebook of exercises here. See the Resource 2 section for the code applicable to what I did today.
View my Python code for the Day 2 challenge here in the Day 2 folder. Remember, as of today, it’s incomplete.