paper 2 section 8 Flashcards
Variable
A labelled area of memory that can be changed by the program
Upper and Lower
.upper converts string to uppercase
.lower converts string to lowercase
sentence=”hello”
print(sentence.upper())
Text Files
To read a text file:
TextFile=open(“test.txt”, “r+”)
OpenText=TextFile.read()
TextFile.close()
print(OpenText)
Subprograms
Set of reusable code that has a set of instructions that is executed when called
SQL
SELECT - specifies which fields to include
FROM - which tables the fields will come from
WHERE - includes any criteria
ORDER BY - sorts the results
* - All
Sequencing
Putting instructions in order to perform a task.
Selection
Conditions used to decide whether code is executed.
Procedure
Doesn’t return a value
print()
Iteration
Repetition of code.
Indexes
Characters in string can be referenced by index
studentname=”Rina”
studentname[0] is R
Functions
Returns a value
def number():
result=2*2
return(result)
Database
A collection of records each having an identical record structure
Data Types - String
Several keyboard characters
Str
Data Types - Real/Float
A fraction/decimal
float
Data Types - Integer
A whole number
int