Programming fundamentals Flashcards
what is a string
a group of characters
what is quotient (DIV)
does the division but cuts off the decimal
what is modulus(mod)
gives the remainder of the
for a and Boolean to work what has to take place
both sides need to be true
what is the code for substring
.substring(start, how many )
what are variables
identifiers that hold value that can be changed
what are constants
identifiers that hold value and connot be changed
const PI = 3.142
what is user input always
a string
what are the 3 fundamental programming constructs
sequence
selection
iteration
what is selection and what code do you use
process of making a decision
if - always checked
elseif - only checked if previous conditions were false
else - no conditions and only checked if all previous conditions were false
during a switch case statement what do you use
switch == if
case
default =else
endswitch
option = input (“select option 1 or 2.”)
switch option:
case “1”:
print(“Welcome to the program.”)
lauchprogram()
case “2”:
settings()
default:
print(“goodbye”)
endswitch
when are switch case useful
where a variable determines the selection
what are count controlled loops
repeaats a set number of time
FOR loop
FOR i = 0 to 5 THEN
print (i)
next i
what is iteration
where code repreats
what is a condition controlled loop
WHILE loop - repeats until a condition is broken
DO UNTIL repeats until a condition is met
password = input(“PW: “)
while password != “123”
password = (“PW: “)
endwhile