Unit 7 - Programming Flashcards
What are the 5 different data types?
Integer, float, character, string, boolean
What are the 6 arithmetic operators?
+, -, ^, *, /, DIV, and MOD
How to cast for different data types?
str()
float()
int()
bool()
What are the three operators used in Boolean expressions?
AND, OR, NOT
What is sequence?
Instructions that are carried one after the other in order.
What is selection?
Instructions that can evaluate a Boolean expression and branch off to one or more alternative paths. An ‘if’ statement is a selection statement.
What is iteration?
Repetition of a section of code.
Two types:
for…….next
while…….end while
What is a FOR loop?
It is a fixed loop - code is repeated a known number of times.
What are WHILE loops?
Use this when you want to execute a loop WHILE a condition is true.
What is an array?
An array is a data structure that allows you to hold several variables, all of the same types, with one name. In Python, there are no arrays, only lists.
What are two different types of subroutines?
Functions and Procedures.
What is a function?
A block of code within a program that is given a uniquely identifiable name. Can take upwards of zero parameters when it is called and should return a value. Should be designed and written to perform a task or action that is indicated by its name.
What is a procedure?
A block of code within a program that is given a unique, identifiable name. Can take upwards of zero parameters when it is called. Should be designed and written to perform a task or action that is indicated by its name.
What are subroutines?
Used to break up a large program into smaller chunks.
What is a record?
It is a data structure consisting of several fields which can all be of different types.