Exam 1 Flashcards

(37 cards)

1
Q

variables

A

named storage bins that hold onto values

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

assignment statements

A

a line of code that assigns a value to a variable

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

float

A

numbers with decimals
float()

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

integers

A

numbers without decimals
int()

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

string

A

text
str()

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

comments

A

used to explain code
#

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

variable naming conventions

A
  • cannot start with numbers
  • no numbers after _
  • all lowercase
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

expression

A

any mathematic calculation found on the right side of a statement

ex: x + 3

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

//

A

integer division

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

%

A

remainder division

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

input()

A

accepts a value from the user (always stored as a string)

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

opening a file

A

with open(“file_name”, “r”) as infile:

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

reading a file line

A

infile.readline()

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

skipping a file line

A

next(infile)

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

plotting import statement

A

import matplotlib.pyplot as plt

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

main plotting functions (5)

A

Plt.plot(x, y, marker)
Plt.title(title)
Plt.xlabel(xlabel)
Plt.ylabel(ylabel)
Plt.show( )

17
Q

boolean

A

a data type that can only store 2 values (True or False)

18
Q

comparison operators

A

> , <, <=, >=, ==, !=

19
Q

for loop

A

for item in sequence:

20
Q

range function

A

range(start, stop, step)
not inclusive of “stop”

21
Q

accumulator loops

A

initialize, iterate, update, report

22
Q

indexing

A

list[start:stop:step]
not inclusive of “stop”

23
Q

concatenating lists

24
Q

adding to lists

25
length function
len()
26
split function
string.split() splits a string on a space or other specified character and creates a list
27
replace function
string.replace(a, b) replaces all a with b
28
strip function
string.strip() removes all white space
29
lower case / capital function
string.upper / string.lower
30
checking for all numbers in a string
string.isdigit()
31
checking for all letters in a string
string.isalpha()
32
insert in a list
list.insert(position, element)
33
remove from a list
list.remove(element)
34
remove the last element from a list
list.pop()
35
finding the index number
list.index(element)
36
while loop
while condition:
37
reading a CSV
1. Create an empty list 2. Use the with open function 3. For row in file: a. List.append(row.strip())