Wednesday, 8 January 2014

Program Comments and Docstrings

In Python we double quotation (") or single quotation mark for Docstrings  and pound sign(#) for single line comment.

"""
This is a python comment
This is a python comment
This is a python comment
"""

# Assign a value to radius
#this is also python comment
radius = 20# radius is now 20 radius 20

# Compute area
area = radius * radius * 3.14159

# Display results
print("The area for the circle of radius", radius, "is", area)

No comments:

Post a Comment