Save
CS
Unit 7 - Programming
Save
Share
Learn
Content
Leaderboard
Learn
Created by
pee pee
Visit profile
Cards (36)
Variables are the
values
that can be
changed
in a program. They are used to store
data.
Constants are
values
that are used in the program and
do not
change.
Operators are used to perform
calculations
and assign
values
to variables.
Inputs are
data
that needs to be
input
by the
user.
Outputs are the data that is
output
at the end of the program.
Assignment is the use of
=
to assign a
value
to a
variable.
Sequence
is the
order
that the program has to be in to work correctly.
Iteration allows a program to
repeat
a set of
instructions
a specified
number
of times.
Selection is a
decision
or a
question.
Boolean operators decide whether a
statement
is
true
or
false.
MOD
is the
remainder
of a
division
equation.
SQL stands for
Structured Query Language
SELECT
lists the
fields
to be displayed (comes
1st
)
SQL statements can be used in Python to create a
database
, add, amend,
delete
records and fields and search for data.
FROM
specifies the
table
name (comes
2nd
)
WHERE
lists the
search
criteria (comes
3rd
)
ORDER BY
can be used to order the data in a specific way (comes
4th
)
Subroutines
are small programs that are called by the
main
program to perform a
specific
task.
Functions
and
procedures
are both subroutines.
Functions
will return a
value
after processing takes place while
procedures
will not.
Parameters
are the
names
listed in the function
definition.
Arguments
are the
real values
passed into a function.
Subroutines
are used useful to break up large programs into smaller units.
Subroutines can be stored in a
subroutine
library
to be used later.
Subroutines make program
maintenance
easier.
Local variables
are variables declared
inside
a function and can only be used
inside
the function.
Global variables
are variables declared
outside
a function and can be used
anywhere
in the program.
Arrays
are
data structures
that allow you to hold many items of data which is referenced by
one
identifier.
All
items of data in the array must be the same
data type.
An array of 10 strings called userNames could be declared as:
array userNames[10]
Information can be
read
from or
written
to the array using the
index number.
In Python, the index number starts at
0.
An array has a
fixed
length.
Python does not have arrays. Instead,
lists
are used.
A list has a
changeable
length.
A for loop that could be used to output the data in an array of usernames is:
for i = usernames.length
:
print(usernames[i])