Learning Python

- 3 mins

Learning Python

At the Begin of May I decided to extend my programming language toolbox by learning Python. The Coursera Python Specialization by University of Michigan made a great first impression to learn the basics of Python.

In about three weeks I’ve learnt the difference between Lists, Tuples, and Dictionaries. In the final part of the course had the goal to design and create your own python application for data retrieval, processing, and visualization. A capstone project that allows to use the new gained knowledge in a real world case.

My three takeaways

  1. Indentation is key and the most distinctive features of Python to indent blocks of code.
  2. Debugging tools and methods are essential and should be included at the beginning of every programming language course.
  3. Python is a very powerful language (easy to learn, user-friendly, widely used, runs on (almost) any platform) that paves the way for new, exciting directions to explorer, especially via all the scientific libraries.

One important part I was missing in the course was how you actually debug or trace a error. After looking around on Google and StackOverflow I found a very useful debugging tool called Python debugger pdb. This debugger is equivalent to Ruby’s byebug and easy to use.

It is essential to learn how to debug/trace errors right at the beginning when diving into a new programming language. It helps to understand what is going on, how the nature of the language works, and will make your life way easier to understand the bigger picture.

Run a python script from the command line by using the Python debugger:

  python -m pdb my_script.py

Import the Python debugger at the top of the file:

  import pdb;

Set the breaking point anywhere in your file by:

  pdb.set_trace()

Read more about how to become a pdb-power user on Medium.

This course has sparked the curiosity in me to use Python to explore and extent my knowledge further in building.

You can find the my capstone project on Github.

One fun eater egg for the end

Type following in your Python console.

  >>> import this
  The Zen of Python, by Tim Peters

  Beautiful is better than ugly.
  Explicit is better than implicit.
  Simple is better than complex.
  Complex is better than complicated.
  Flat is better than nested.
  Sparse is better than dense.
  Readability counts.
  Special cases aren't special enough to break the rules.
  Although practicality beats purity.
  Errors should never pass silently.
  Unless explicitly silenced.
  In the face of ambiguity, refuse the temptation to guess.
  There should be one-- and preferably only one --obvious way to do it.
  Although that way may not be obvious at first unless you're Dutch.
  Now is better than never.
  Although never is often better than *right* now.
  If the implementation is hard to explain, it's a bad idea.
  If the implementation is easy to explain, it may be a good idea.
  Namespaces are one honking great idea -- let's do more of those!
  >>>

You can read those aphorisms up on the official Python website.

Florian Josef Reheis

Florian Josef Reheis

Business Controller turned Developer. Ruby on Rails Developer & Digital Marketer

comments powered by Disqus
rss facebook twitter github youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora