Week 4 Flashcards

1
Q

How do you prevent logic/runtime errors?

A

Write tests

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

What three things should names convey?

A
  1. Effect
  2. Behavior
  3. Value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a function docstring?

A

A string that provides documentation about the functions purpose, parameters, return values, etc.

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

What is a function specification?

A

A function signature plus docstring

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

How do you uninstall a library?

A

pip uninstall library_name

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

How are command-line arguments returned?

A

As a list of strings

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

What are typical variable names for real numbers?

A

x, y, z

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

What are typical variable names for functions?

A

f, g, h

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

What are typical variable names for integers?

A

n, k, i

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

What types of errors are the easiest to find?

A

Syntax

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

What does typing cat -A filename.py in the terminal do?

A

Show tabs and spaces

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

What does the getattr method do?

A

Returns the value of an attribute of a specific object/instance.

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

What does the hasattr method do?

A

It checks if the object has a specific attribute

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

What does the type method do?

A

It gets the type of an object

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

How are class names formatted?

A

Snake title case

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