Skip to main content

#100DaysOfCode, Days 019 & 020 – Corey Schafer Python Video Marathon

Only a few more videos done on the Corey run.
But those were important ones.

I finally got classes. Like got, got them.
And I learnt about subclasses and dunder methods and decorators and getters and setters and all that jazz.
And I understood it all.
And now when I sit to code or read other people’s code, it won’t be as frustrating.

And the more I watch and practice and read code, the more I seem to understand. Python seems to be slowly getting into my muscle memory.
A dam seems to have broken.
I don’t struggle as much.
(That could also mean, I am not reading complicated code yet :P)

49 of 127, done.

How to be Unhappy (Or Happy!)

Riffing off a quote in last week’s newsletter,

Make any behaviour you want to encourage easier to do, and any behaviour you want to discourage harder to do.

How to Be Unhappy:

  • stay inside all day
  • move as little as possible
  • spend more than you earn
  • take yourself (and life) too seriously
  • look for reasons why things won’t work
  • always consume, never contribute
  • resent the lucky and successful
  • never say hello first
  • be unreliable

Invert for happiness:

  • get outside each day
  • move: walk, exercise, dance
  • spend less than you earn
  • view life as play
  • be the one who looks for solutions
  • develop a bias to contribute and create
  • learn from the lucky and successful
  • be the first to say hello
  • be reliable

I stole this from James Clear’s 3–2–1 newsletter.
You should subscribe. They are short, pithy and awesome!

P.S. Subscribe to my mailing list!
P.P.S. Feed my insatiable reading habit.

#100DaysOfCode, Day 015 – Quick and Dirty Web Page Download

Finally got the program done!
I wanted to write a program that would just get the latest comic from and save the picture to a file.

In the course of writing this little program,

  • I learnt about the basics of context handlers
  • I learnt about the os module in Python
  • I learnt how to scrape a web page using requests, beautiful soup and feedparser. (I was going to originally scrape the web page, but then realised that processing the rss feed would be more efficient. I think it’ll also help me extend/improve the program better, later.
  • It helped me practice, slicing and dicing Python lists and dictionaries and getting data out of them.
  • I learnt how to write and save files to disk.

This was really fun to do.
I see a million ways to take this dinky, little program forward. It could do the whole site for example or download only after comparing the state of the rss feed and fetching new entries etc. It has no error handling at all currently, and I prefer to have very safe, very conservative programs as a user. So lots of work to do. I leave all this for a later date though, while I now forge ahead with my #100DaysOfCode journey.
Getting back to the challenges of the course itself, tomorrow onwards.

#100DaysOfCode, Day 014 – Classes, List Comprehensions and Generators

Did a video session again today, since I came back late from the doc.

Watched videos about building a small d&d game, using classes.
This was fun :)
Working on the challenge will be exciting.

And then some more on list comprehensions and generators.
I had one aha, about tools as I watched this.
The instructor used a regular expression to process a list and that little line, cut down his code by lots.
That made me realise that programming is simply picking up the right tool for the job, and that there are a plethora, to do the work you need to do. One is not necessarily better than the other, just that some are better suited to the job at hand, than others.
Revised how list comprehensions and generators work.
And like a dork, I just realised that the operative thing is comprehension. You write in a comprehensive way to build some sort of collection. A list comprehension to write lists, a dictionary comprehension to build a dictionary, a generator comprehension to … well, you get the idea :)

This is all I got for today.
Will work more tomorrow.

#100DaysOfCode, Day 013 – Test code using Pytest

Watched the video on the upcoming challenge to learn testing code.
Sounds challenging.
There are classes and decorators, which I have not worked with, but just read about.

Will see how it goes.
The idea of test driven development though, seems right up my alley.

#100DaysOfCode, Day 012 – Data Structures Video Refresher

Extremely tight and busy day today.
But still made the time to watch the videos for the next challenge in the course.
As a matter of fact, I think this is what I should do.
If I am in office, I ought to watch videos.
And spend the time at home when I can coding.

What videos?
The next little project they have involves data structure basics.
So today’s videos took me through lists and tuples and dictionaries.
And with this, I call it a day.