Python Syntax, Indentation, Comments, Variables, Data Types, Numbers, Casting, and Strings
Classified in Computers
Written on in English with a size of 5.67 KB
Python Syntax
As we learned in the previous page, Python syntax can be executed by writing directly in the Command Line:
>>> print("Hello, World!")
Hello, World!
Python Indentation
Indentation refers to the spaces at the beginning of a code line.
Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important.
Python uses indentation to indicate a block of code.
if5 > 2:
print("Five is greater than two!")
Python will give you an error if you skip the indentation:
if5 > 2:
print("Five is greater than two!")
Python Comments
Comments can be used to explain Python code.
Comments can be used to make the code more readable.
Comments can be used to prevent execution when testing... Continue reading "Python Syntax, Indentation, Comments, Variables, Data Types, Numbers, Casting, and Strings" »