slides and exercise part 6
This commit is contained in:
parent
e5ce019f24
commit
ba06dd1ba5
45
exercises/Exercise 6a PEP8.md
Normal file
45
exercises/Exercise 6a PEP8.md
Normal file
|
@ -0,0 +1,45 @@
|
|||
## Exercise 6a: PEP8
|
||||
|
||||
#### Goal
|
||||
|
||||
Get you familiar with some of the fun facts hidden in the PEP8 guide.
|
||||
|
||||
#### Preparation
|
||||
|
||||
(none)
|
||||
|
||||
#### Tasks
|
||||
|
||||
0. Navigate to [PEP8](https://peps.python.org/pep-0008/).
|
||||
|
||||
1. Depending on your assigned letter, answer the questions in the corresponding
|
||||
set below. Feel to tackle the questions out of order. You can also split the
|
||||
questions between your pair, but be you must leave time to discuss the answers
|
||||
together.
|
||||
|
||||
##### Set A
|
||||
1. What should you use instead of if y == None?
|
||||
2. If you have an acronym in camel case, should you capitalize the first letter
|
||||
only or the whole acronym?
|
||||
3. How should you check if a variable equals False?
|
||||
4. What is important about how underscores work with variable names? What happens
|
||||
if I put an underscore after a variable? One before? Two before?
|
||||
5. How many spaces should you use after a period in a comment?
|
||||
|
||||
##### Set B
|
||||
1. What are the capitalization guidelines for classes, functions, and variables?
|
||||
Give examples.
|
||||
2. How should you check if a path ends in .txt?
|
||||
3. What is the difference between mixed case, camel case, and snake case?
|
||||
4. How should you indicate block comments?
|
||||
5. What are the whitespace rules around operators? Give several examples.
|
||||
|
||||
##### Set C
|
||||
1. If I need to import os, sys, numpy, matplotlib, and a local module called
|
||||
_utils.py, what does my import block look like?
|
||||
2. How many blank lines go before a function I define at the top of a module? How
|
||||
many after?
|
||||
3. Which of these is correct: x[3:4] or x[3 : 4]?
|
||||
4. Should you use single or double quotes to indicate strings?
|
||||
5. Give examples of a long line of code and how you can break it onto multiple
|
||||
lines.
|
Binary file not shown.
Loading…
Reference in a new issue