Pseudocode Flashcards
Pseudocode - assign a variable (x)
x = 3
Pseudocode - cast a string varaible
str(3)
Pseudocode - cast a float variable
float(“3.14”)
Pseudocode - cast an integer variable
int(“3”)
Pseudocode - make a global variable (userid)
global userid = 123
Pseudocode - print a string (hello)
print (“hello”)
Pseudocode - gather an input (name)
name = input(“enter name: “)
Pseudocode - print (hello) 8 times
use iteration
for i = 0 to 7
print (“hello”)
next i
Pseudocode - 2 ways to ask for (password) until it matches (computer)
while answer!=”computer”
answer=input(“What is the password?”)
endwhile
OR
do
answer=input(“What is the password?”)
until answer==”computer”
Pseudocode - MOD gives the ___ - 12MOD5
remainder - 2
Pseudocode - DIV gives the ___ - 17DIV5
quotient - 3
Pseudocode - if, elif, else
if … then
…
elif … then
…
else
…
Pseudocode - how to get the length of a string (name)
stringname.length
Pseudocode - how to get a substring
string.substring(start postion, num of chara)
shows (a,b) a-b
Pseudocode - make a function (triple)
function triple (number)
return number*3
endfunction