Python Block Comment

Python use # symbol to comment out the codes.

>>> x = 3; #define x

Python do not have multilines blocking functions such as /* .... */ in other languages.
Typically, people use triple-quotes strings """, ''' as multiline comments.
def cm2inch(h):
assert(h>=0), "height must be positive";
return(h*0.3937);
"""Before convert centimeter to inch,
confirm the input value is positive"""
'''Before convert centimeter to inch,
confirm the input value is positive'''




















endmemo.com © 2024  | Terms of Use | Privacy | Home