2.2 Basic Python Syntax and Structure
Python Programming
The following Python program demonstrates the simplicity and readability of the language:
python
print("As - Salaam-Alaikum, College Students!")In this example, the print function is utilized to output the message enclosed in double quotation marks. This illustrates Python's straightforward syntax, where functions like print are used to perform actions such as displaying text.
Python Comments
Lines that are not executed by the Python interpreter. They are used to provide explanations or notes for the code. Single-line comments start with the # symbol while multi-line comments can be created using triple quotes (”') at the beginning and the end as shown below.
python
# This is a single - line comment
print ( "K2 is the second-highest mountain in the world " )
'''
This is a multi-line comment.
It can span multiple lines.
'''