Check out this video for an overview of the article. Then, read the article and solve exercises to strengthen your understanding.
Welcome to this Crash Course on “Python” Programming! In this course, we will provide you with an overview of the world of “Python” programming. While we won’t delve into details, you will gain a basic understanding that will set the foundation for further exploration in our additional articles. Let’s dive into the exciting realm of “Python” programming together!
1 Print function
The print()
function is used to display output. This is probably one of the most famous code in the programming world:
print("Hello, World!")
Hello, World!
This simply print Hello, World!
.
2 Comments
Comments in “Python” programming are lines of text that are ignored by the interpreter. You can add comments to explain your code or provide information to other developers. Comments are preceded by the hash symbol (#
).
There are basically two types comments.
The first one is the inline comment:
print("result") # Printing the result. This is an inline comment
result
- An inline comment is on the same line as a single line of code.
- The comment is on the right side of the code.
- The code and the comment are separated by at least two spaces, with the comment starting with a
#
followed by a space.
The other comment is the block comment:
# Today's fruit for the lunch
fruit = "apple"
Block comments are for the codes that follow them. In this code, the comment explains fruit = "apple"
. We can understand an apple is for our lunch. A block comment starts with a #
followed by a space.
3 Exercise
Print This is my code.
using the print()
function.