-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComments.py
More file actions
40 lines (32 loc) · 981 Bytes
/
Copy pathComments.py
File metadata and controls
40 lines (32 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Comments :-
# Comments are used to explain code and are ignored by the Python interpreter.
# Single-line comments start with #.
# Multi-line comments are enclosed in ''' or """.
# This is a single-line comment
'''
This is a
multi-line comment
'''
# This is a single-line comment
print("Hello, Python!") # This is an inline comment on the same line as code
# This is the first line of a multi-line comment.
# This is the second line.
# This comment explains a block of code.
x = 10
y = 20
print(x + y)
"""
This is a multi-line comment using triple double quotes.
It can span across multiple lines and is often used for documentation (docstrings).
"""
'''
This is another example of a multi-line comment
using triple single quotes.
'''
def greet(name):
"""
This function takes a name as input and prints a greeting.
This is a docstring explaining the function's purpose.
"""
print(f"Hello, {name}!")
greet("Alice")