Mastery 7 – Use of comments in Python

You may understand your code perfectly just after you wrote it, but if someone else tries to know what you did or some years later you want to accurately remember what you had done, it can get tricky, but worry not! Comments are your saviour!

On Python, comments’ syntaxis starts with asign, everything after that, on the same line of code, is read as a comment. It will be ignored in the process of running your program so it don’t affect anything at all.

c1

You can even use comments to debug a program avoiding a certain chunck of code without having to erase it to see how it affected the program.

c2

Mastery 10 – Basic output (print) in Python

An output is data generated by a computer, put simply, it is what the user recieves form the computer. Print is a basic output command that shows the user a string value.

As shown above, the syntaxys of print in v.3 of Python is:

print (“String”)

On previous versions the () were not needed, but in this version they are mandatory.

When run, this line of code will only show what is inside the (” “), in this case the output would be:

String

CC BY 4.0 Masteries 7 & 10 by carminaperezguerrero is licensed under a Creative Commons Attribution 4.0 International License.