Python Code Comprehension

Code comprehension exercise

The truth is that we programmers spend a lot more time on reading code than writing it. Simple conclusion: we should improve our code reading skills. Thus this exercise will focus on code comprehension.

Objectives:

  1. Create your GitHub repository with accepting the invitation below

  2. Read and understand it.

  3. Add the top of the file add one sentence comment describing what this program does.

  4. Comment every line of the program to describe what’s going on in it. Use technical language, make comments as short as possible (Less is more). Example comments:

    x = 5 # Assign 5 to x variable y = [1,2,3] # Initialize list with values for a in y: # Loop through y list. Assign each value to a variable

  5. Do not edit the code. Only comments are allowed.

  6. Commit and push your changes, and submit your repository URL when ready

Disclaimer

In real life you shouldn’t comment your program this way. For a real programmers x = 5 is something obvious. This exercise is just to check if it’s obvious for you too.

GitHub classroom project

Here you can find the Github repository as your individual assignment. Please accept the invitation: http://go.code.cool/pbwp-code-comp

This exercise improves your technical language.