Save
Computing
Paper 2
2.2
Save
Share
Learn
Content
Leaderboard
Learn
Created by
tonks179
Visit profile
Cards (21)
Programming
constructs:
Sequence
Selection
(if statements)
Iteration
(loops)
Length of a string
len(varString)
Upper case
varString.upper()
Lower case
varString.lower
()
Random numbers
import random
var = random.randint(1,6)
Change to
ASCII
var
=
ord
("A")
var
= ASC ("A")
Change to character
var
=
chr(65)
var
=
CHR(65)
New line
\n
Tab
\
t
Use
apostrophes
\'
Overwrite
or make a
new file
"w"
Append to a file
"
a
"
Read a file
"
r
"
Open a file (to read)
var
=
open
("fileName.txt","r")
Read the whole file
data =
var.read()
Read a line at a time
data =
var.readline()
Append a file
var.write(var2)
Close a file
var.close()
SQL
Select
From
Where
Procedure
Does something
Function
Returns to a
variable