Save
COMP SCI 110 Quiz 1
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Liver
Visit profile
Cards (74)
(
int
) = integer = positive or negative
whole
numbers
(
float
) =
floating
point
number = real numbers, like -2.5
(
str
) =
string
= character
text
"hello world"
strings
are contained in
matching quotes
(single or double)
+
=
addition
addition
(
+
) adds values on either side of the operator
– =
subtraction
subtraction
(–) subtracts
right
hand operand from left hand operand
* =
multiplication
multiplication
(*)
multiplies
values on either side of the operator
/
=
division
division
(
/
) divides left hand operator by right hand operator
** =
exponent
exponent
(
**
) performs exponential (power) calculation on operators
% =
modulus
modulus
(
%
) divides left hand operand by right hand operand, returns remainder
// =
quotient
quotient
(
/
/) divides left hand operand by right hand operand, returns quotient
= is the
assignment
operator
operators perform on
operands
+ (on strings) =
addition
string addition
adds
the left and right operands
* (on strings) =
repetition
repetition
repeats the left string a number of times specified by the right operand
python is case
sensitive
snake case = all
lowercase
,
underscores
for
spaces
function calls always consist of the
function
name
and a set of
parentheses
variables
allow us to store and access data
the first character of a variable cannot be a
digit
inputs
in a function are separated with
commas
positional
parameters are required
order matters for
positional
parameters
keyword parameters are always
optional
and always
specified by their keyword
keywords
are always passed into a function
after
positional parameters
order of
keyword
parameters (after positional parameters)
doesn't
matter
keyword parameters always have a
default
value
reporter
functions
return
a value
(
input
) prompts the user for some data, and
reports
back
(
returns
) the user input as a
string
functions are described with a
type
signature
, which specifies what the function takes as
input
, and what they give as
output
a function
header
begins with
def
and ends with a
colon
See all 74 cards