Comments are used to explain code to someone reading your program. That means that a comment like this
num_users = 30 # This code sets the number of users to 30.is not particularly useful. The comment is redundant because someone reading your code can tell that the variable num_users is being set to 30 from the line of code. Instead, if this is an important line of code, explain why the variable is being set to 30.
Think of comments as explaining to a reader or user what your program is doing.
''' * Program or Lab #: Insert assignment name * * Programmer: Insert your name * * Due Date: Insert due date * * COMP141, Fall 2019 * * Pledge: I have neither given nor received unauthorized aid * on this program. * * Description: Insert a brief paragraph describing the program * * Input: Insert a brief description of user inputs, or "None" if * there is no user input * * Output: Insert a brief description of the program output * '''Note: You can copy and paste the comment lines shown here to the top of your assignment each time. You will need to make the appropriate changes for each assignment (assignment number, assignment name, due date, description, input, and output).
# This function computes the circumference of a circle. # Parameters: r, the radius of the circle. # Returns: the circumference of the circle. def circumference_of_circle(r): return 2 * 3.14 * r