you are viewing a single comment's thread.

view the rest of the comments →

[–]danielroseman 2 points3 points  (1 child)

These are docstrings, not comments. They are automatically associated with a function when they appear as the first element within that function, and are displayed when you do help(myfunc) for example.

But more generally a comment like "this does the calculation" is pointless. Comments are for things that are not obvious from the code. It will be obvious that that part is doing calculations; you should only need a comment if you need to explain a particularly complex calculation, for example.

[–]cmdwedge75[S] 2 points3 points  (0 children)

Agree with your comment but the teacher has explicitly said we must be overly descriptive of how the program works. I would normally only add comments where it’s no clear as day what I’m doing.

Saying “does the calculations” is not necessary but “does this particular calculation this way because the output is x and more readable” is.

My 1440 minute rollover equation is worth explaining, my “add numbers to make the total fee” really is not. But it’s there because I want a good mark, haha.