How to Use Comments For Debugging in Python, My Second Introduction Into Object Oriented Programming

In this blog post, I’ll show you how to use comments for debugging in Python, and will reiterate what my second Python lesson looked like just now.  In this morning’s lesson, I learned the importance of using comments when writing code in Python, and found out a couple of really cool and useful tricks that you can use for finding out which code might have an error in it. I think we may have a lot more programming and computer science related blog posts coming your way on the website, in that I’m starting to have some fun with my beginner Python learning lessons, and while I am not 100% how long this pace will last, I am planning on doing a heck of a lot more programming lessons and posting them all on my blog, so stay tuned for more information and as always, remember to subscribe!

How to Use Comments for Debugging in PythonSome of the cool features that you can use with comments are:

Ctrl + K + C as a shortcut in order to comment something out

Ctrl + K + U in order to uncomment something out

Use comments for Debugging

Keyboard Shortcuts

Using the # feature instead of — like is done in SQL

How to comment things out for testing

And a host of other cool features, I am starting to get the hang of some of the basics of Python, which to be frank is a little bit scary to me, as I never real thought I’d get much of a grasp on any of it. In a year’s time if I keep this up, who knows maybe I’ll even be functional at Python.

What I Learned Today in Python, How to Use Comments for Debugging in Python

Okay so, unlike in say the SQL language, which is the only language besides say Python and HTML now that I really have any sort of familiarity with, in Python, you comment something out using a hash tag, such as #, rather than a dash dash, — like in the Postgre SQL language. And so, without further ado, here’s what I learned today in my Python class:

A basic comment would look something like this:

  1. # this line of code does nothing because it is commented out
  2.  print(‘hello my friends’) –this would be a working line of code
  3. print(‘it’s a small world after all’) this line of code would not work because there is a single quotes inside of a single quotes, so you would need to use double quotes in order to fix this and run that line of code successfully, if you run that line of code it will give you a syntax error which comments can help you find in the case that you have 500 or so lines of code in a program that you are writing.
  4. print(“it’s a small world after all”) –is a functional line of code because you can either choose to use double quotes or single quotes, but have to use double quotes if there is already a single quote in the line of code.

 

Related Posts

If anyone is a programmer and is reading this, yes I know that this is the most basic and rudimentary type of coding that you can possibly think of, but I’ll tell you this much, the finance guys reading this right now think I am a gosh darn genius!

My Final Thoughts on How to Use Comments for Debugging in Python

And so, using comments for debugging is a very important part of Python, and blah blah blah. To the finance guys out there reading this, I’ve got to tell you that if you want to accelerate your careers, look at a combination of SEO, Programming via Python and SQL, Accounting, and the CFA Exams, this is the combination that I am shooting for, and although it is a highly highly analytical task, I think that it is entirely doable, and that it will definitely help you to start snowballing your career in a very positive way if you can pull it off. For more information, be sure to subscribe to our blog or to comment down below, thanks for reading!

 

Cheers!

 

*Inflation Hedging.com

Sources:

https://www.bankrate.com/banking/cds/cd-rates/

https://money.cnn.com/data/markets/

 

Disclaimer: The opinions and documentation contained within this article and on this blog are the sole property of inflationhedging.com and are not to be copyrighted or reproduced in any manner, else legal action within the rights of the United States legal code could be use to obtain recompense. All articles and blog posts are the sole opinions of the writers of the blog, and are not necessarily in line with what exactly will work for you, you should consult a CPA, Tax Professional, or Financial Professional to determine what exact financial needs are in line with your interests. Also, from time to time, certain links on this website will be used to generate affiliate commissions, in order to support the health and growth of our website, health and business.