Exam 1 Flashcards
(37 cards)
variables
named storage bins that hold onto values
assignment statements
a line of code that assigns a value to a variable
float
numbers with decimals
float()
integers
numbers without decimals
int()
string
text
str()
comments
used to explain code
#
variable naming conventions
- cannot start with numbers
- no numbers after _
- all lowercase
expression
any mathematic calculation found on the right side of a statement
ex: x + 3
//
integer division
%
remainder division
input()
accepts a value from the user (always stored as a string)
opening a file
with open(“file_name”, “r”) as infile:
reading a file line
infile.readline()
skipping a file line
next(infile)
plotting import statement
import matplotlib.pyplot as plt
main plotting functions (5)
Plt.plot(x, y, marker)
Plt.title(title)
Plt.xlabel(xlabel)
Plt.ylabel(ylabel)
Plt.show( )
boolean
a data type that can only store 2 values (True or False)
comparison operators
> , <, <=, >=, ==, !=
for loop
for item in sequence:
range function
range(start, stop, step)
not inclusive of “stop”
accumulator loops
initialize, iterate, update, report
indexing
list[start:stop:step]
not inclusive of “stop”
concatenating lists
list + list
adding to lists
list.append