Python Comments Flashcards

1
Q

Comments can be used to explain Python code.

A

Python Comments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Comments can be used to make the code more readable.

A

Python Comments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Comments can be used to prevent execution when testing code.

A

Python Comments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Comments starts with a #, and Python will ignore them:

A

Creating a Comment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Comments can be placed at the end of a line, and Python will ignore the rest of the line:

A

Creating a Comment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A comment does not have to be text that explains the code, it can also be used to prevent Python from executing code:

A

Creating a Comment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

To add a multiline comment you could insert a # for each line:

A

Multiline Comments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Since Python will ignore string literals that are not assigned to a variable, you can add a multiline string (triple quotes) in your code, and place your comment inside it:

A

Multiline Comments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly