Lesson 7 Flashcards

1
Q

Syntax

A

The rule of a programming language. Computers cannot execute to a program with improper syntax.

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

Style

A

Writing code in a way that makes it clear and easy for human to read. Computers can execute programs written in poor style.

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

Why is good style important?

A

Code written in poor stylist to difficult to understand. Programmer spend most of their time updating maintaining or fixing existing code. Software is developed in teams and should not rely on a single developer.

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

Comments style convention

A

Include a header box at the beginning of a program containing basic information about the program use “”” to start and end comments”””

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

Internal comments

A

Write your program comments before you start writing code. This will help you organize the logical flow without worrying about syntax. Include comments, even for simple programs. Include comment boxes at the start of major sections of code. Use eye-catching formats as appropriate.

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

How long should lines of code be?

A

Lines should be less than 79 characters and comments less than 72

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

Style conventions

A
  • use spaces around operators
    -Use a snake case style for variable naming
    -Use meaningful comments that explain why
    -variables intended to be constant should be named with uppercase
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Debugging

A

Debugging is the process of identifying, analyzing, and fixing errors in computer program.

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

Debugging process

A

1) bug, identification, detecting, unexpected behavior or errors in the program.
2) bug analysis, understanding the cause of the issue through testing and inspection
3) fixing, correcting the faulty code while ensuring it does not introduce new issues
4) verification to confirm the fix does not affect other parts of the program

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

The most basic debugging technique

A

Include print statements to display information at various points and program.
However, it’s not scalable for large programs and they may need to be removed later

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

Breakpoints

A

Breakpoints are a line of code where the python interpreter will pause the program until given permission to execute the line and proceed. To enable breakpoint, you must run the script with the D bugger.

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

Six common subclasses of exceptions

A

Syntax error
Name error
Type error
Value error
Key error
Zero division error

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

Syntax error

A

Incorrect python syntax

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

Name error

A

Using a variable that is misspelled or hasn’t been defined

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

Type error

A

Performing an invalid operation given the data type

17
Q

Value error

A

Passing an invalid argument, or removing an item from a data structure that does not exist

18
Q

Key error

A

Referring to a key that does not exist in the dictionary

19
Q

Zero division error

A

Dividing by 0

20
Q

Four blocks to handle exceptions

A

Try
Except
Else
Finally

21
Q

Try

A

Where are you put your code that might cause an air

22
Q

Except

A

Where are you put code to handle the error

23
Q

Else

A

Code to run when no exceptions are raised

24
Q

Finally

A

Code that runs no matter what happens

25