Statements & Comments Python
In Python, statements are instructions that perform some action. A statement can be a simple expression or a complex sequence of expressions, assignments, and control structures. Here are some examples of statements in Python:
x = 5 # assignment statement print("Hello, world!") # print statement if x > 0: # if statement print("x is positive") else: print("x is zero or negative")Source:www.theitroad.com
Comments in Python are used to add explanatory notes to your code that are ignored by the interpreter. Comments start with the hash symbol (#) and continue to the end of the line. Here is an example of a comment in Python:
# This is a comment print("Hello, world!") # This is another comment
Comments are useful for documenting your code, explaining the purpose of a statement, or temporarily disabling a piece of code for testing purposes. It is generally a good practice to add comments to your code to make it more readable and maintainable.