how to print uppercase
print(Name.upper())
how to print lowercase
print(Name.lower())
how to print length of a string
len(password)
what is slicing a string called
substring
wat does word[2:5] mean
substring beginning at 2 and ending at 5 forms
if [4:], what?
4 characters of the string from the right
if [:4], what?
4 characters of the string from the left
how to close a file
file.close()
how to read txt in file
file.readline()
how to write a file
file.write(“text\n”)
how to show end a file
endofFile = false
how to open a file
file = open(“file.txt”, ”r”)
how to make new file
file = open(“file.txt” , “w”)
how to append file
file = open(“file.txt” , “a”)
a file is the __ of the table
a record is the __ of the table
column ; row
what is put at the end of an SELECT FROM WHERE command
;
how to create 2D array
array = [],[]
how does sub program simplify a program
by breaking it into smaller more managle partsw
hat are parameters
values that are passed into a sub program
what is the difference bewteen a function and a procedure
functions return values while a procedure doesn’tho
how do you call a function
just the name of the function but with the ()
2 stepper for using random number generator in python
inport random
random.randint(1,10)
A variable is a ___ location that holds data that during the execution of a program, can change
named memory
how to find the remainder after division
MOD
how to find the whole number after division
DIV
is it <= and >= or =< and =>
< is always first
what are the 3 core programming constructs and explain their uses
Sequence - lines of code and run int he order that they are written
Selection - the flow of a program is changed depending on conditions
Iteration - loop (for i=0 to )
3 qualities of low level language
directly translates to machine code
direct control over hardware
written for specific processors
compare 3 differences between machine code and assembly code
first generation vs second generation
directly executable (binary) vs translates to machine code
binary vs text abbreviations of commands
translator turns … into …
source code into machine code
example of one low level translator
assembler
examples of 2 high level translators
compiler and interpreter
what is the difference between a compiler and an interpreter
compiler translates the source code all in one go while interpreter does it line by line
IDE makes writing … more ….
high level languages more efficient
what are 4 components of an IDE
editor
error diagnostics
run time environment
translator
4 functions contained within editor
code text font size
colour of text
comments
autocomplete ()
2 functions with error diagnostics
identifier - syntax errors
debugging - logic errors
what does run time environment do
allow the IDE to run the program
what does translator do
inbuilt software for compiling and interpreting code
3 examples of potential errors
Peripheral, Disk, Communication errors
what is defensive design
when every possible input from the user is considered
5 types of input validation
- length - of string
- type - of data
- range - of number
- presence - of whether any data present
- format - of whether data is in the correct format
program maintainability means
programmers can understand each other’s code
iterative testing: each … tested during development
final testing: all … of program function as intended
pathway; modules
types of tests [4]
normal, boundary, erroneous ( wrong data type) , invalid
syntax error is an error that breaks the … rules of a programming language and stops it from running
grammatical
3 main principles of computational thinking:
Abstraction - removing unnecessary details
Decomposition - breaking into smaller tasks
Algorithmic thinking - creating step-by-step instructions in order to produce a solution to a problem
A binary search keeps … a dataset by comparing the target value with the … value, going left if smaller, right if bigger, until it finds the value or realises it's not there
halving; middle;
… sort starts at the beginning and checks values in pair; if not correct order = swapped
bubble