1/53
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
**
power/exponent
//
integer division - division without remainder
%
modulus - remainder from division
from math import*
allows us to use more math functions
sqrt(x)
square root
exp(x)
e^x
what do we have to take in consideration with trig functions?
trig functions take in radian values not degrees
are integers a type of variable?
yes like 1 and -1
are floats a type of variable?
yes like 1.0 and - 2.0
ae Booleans a type of variable?
yes but only True and False
are strings a type of variable?
yes like “Howdy!”
how to convert value to integer
int(value)
how to convert to a float
float(value)
how to convert to a string
str(value)
how to convert into a true Booleans
bool(value) except 0, 0.0, and empty
how to convert into a false Booleans
bool(value) but has to be 0, 0.0, and empty
==
equality
!=
inequality
<, <=
less than, less than or equal to
>,>=
greater than, greater than or equal to
what are the 3 Boolean operators
not, and, or
A and B
True if both A and B are True
A or B
True if either A or B are True
not A
reverse so if A is true it is false
conditional statements
if <condition>:
tab <do this>
when does the code indented inside happens
if the condition is true
if-else
use when there are 2 possibilities
if-elif-else
use when there are more than 2 alternative paths
While loop
while <condition>:
tab <do this>
what does the while loop do
Repeats the indented code until the condition is False
For loop
i = 0
for i in range <condition>:
tab <do this>
what does the for loop do?
Repeats the indented code a specific number of times whether the condition is true or false.
why are comments necessary
clarify your code, computation, and purpose
Typical test cases
test for common possible errors within code
edge or corner test cases
test special error cases that would be less common
loop keyword, break, does what
exits the loop
loop keyword, continue, does what
skips to next iteration
range(i, n, j) define each letter
i = starting value
n = stopping value
j = step “jump” value
how do get a certain rounding in an f-string
f”{variable:.#f}”)
len(list)
length of list
min(list)
minimum value in the list
max(list)
maximum in the list
sum(list)
sum of all variables in the list
list.index(val)
finds the index of the first element in the list whose value matches val
list.count(val)
finds the number of occurrences of the val in the list
list[start: end]
allows you to collect certain values in a list
lists
<list name> = []