Computer-Science-A-level-Ocr
-
3-3-networks8 主题
-
3-2-databases7 主题
-
3-1-compression-encryption-and-hashing4 主题
-
2-5-object-oriented-languages7 主题
-
2-4-types-of-programming-language4 主题
-
2-3-software-development5 主题
-
2-2-applications-generation6 主题
-
2-1-systems-software8 主题
-
1-3-input-output-and-storage2 主题
-
1-2-types-of-processor3 主题
-
1-1-structure-and-function-of-the-processor1 主题
-
structuring-your-responses3 主题
-
the-exam-papers2 主题
-
8-2-algorithms-for-the-main-data-structures4 主题
-
8-1-algorithms10 主题
-
7-2-computational-methods11 主题
-
7-1-programming-techniques14 主题
-
capturing-selecting-managing-and-exchanging-data
-
entity-relationship-diagrams
-
data-normalisation
-
relational-databases
-
hashing
-
symmetric-vs-asymmetric-encryption
-
run-length-encoding-and-dictionary-coding
-
lossy-and-lossless-compression
-
polymorphism-oop
-
encapsulation-oop
-
inheritance-oop
-
attributes-oop
-
methods-oop
-
objects-oop
-
capturing-selecting-managing-and-exchanging-data
-
6-5-thinking-concurrently2 主题
-
6-4-thinking-logically2 主题
-
6-3-thinking-procedurally3 主题
-
6-2-thinking-ahead1 主题
-
6-1-thinking-abstractly3 主题
-
5-2-moral-and-ethical-issues9 主题
-
5-1-computing-related-legislation4 主题
-
4-3-boolean-algebra5 主题
-
4-2-data-structures10 主题
-
4-1-data-types9 主题
-
3-4-web-technologies16 主题
-
environmental-effects
-
automated-decision-making
-
computers-in-the-workforce
-
layout-colour-paradigms-and-character-sets
-
piracy-and-offensive-communications
-
analysing-personal-information
-
monitoring-behaviour
-
censorship-and-the-internet
-
artificial-intelligence
-
the-regulation-of-investigatory-powers-act-2000
-
the-copyright-design-and-patents-act-1988
-
the-computer-misuse-act-1990
-
the-data-protection-act-1998
-
adder-circuits
-
flip-flop-circuits
-
simplifying-boolean-algebra
-
environmental-effects
logical-conditions-in-computational-thinking
Determine the Logical Conditions that Affect the Outcome of a Decision
-
Most errors in a program occur when evaluating a Boolean condition, whether in a sequence as part of a statement, iteration or selection. It is therefore important to be careful when creating Boolean conditions, especially long, complex conditions involving multiple clauses
What are Boolean Conditions?
-
Boolean conditions use combinations of several operators:
-
== (equal to)
-
> (greater than)
-
>= (greater than or equal to)
-
< (less than)
-
<= (less than or equal to)
-
!= (not equal to)
-
AND (both conditions must be true)
-
OR (either or both conditions must be true)
-
NOT (the condition is not true)
-
XOR (only one or the other condition must be true)
-
-
An example of a condition could be a teenager wanting to see a 15 rated movie at a cinema that costs £8. If the teenager isn’t at least 15 years old and doesn’t have enough money then they cannot watch the movie
if age >= 15 and money >= 8 then
entry = True
endif
-
Another example could be checking whether a list contains any numbers and if so, removing them. In order to do this, each item must be checked one by one, checked to see if it is numeric then remove it if so
i = 0
valid_element = True
while len(my_list) > 0:
valid_element = True
element = str(my_list[i])
for index in list_item
if list_item[index] in [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] then
valid_element = False
break
endif
next index
if valid_element == False then
my_list.pop(i)
endif
endwhile
-
The above algorithm is a pseudocode solution to removing numbers from a list of strings
-
The decision points are:
-
While loop: the list has to have at least one element in order for the while loop to run
-
For loop: all elements in the list “list_item” are iterated over one at a time. The stopping condition is reaching the end of the list
-
First if statement: each character in the list “list_item” is checked. If it is a numeric digit then the string contains a number and therefore must be removed. Be aware that in this implementation, a string is considered numeric if it contains even a single digit. Valid_element is set to false and the program breaks out of the for loop
-
Be careful using “break” instructions. They are powerful and help control the flow of control but can be misused and cause unintended problems
-
Second if statement: if the item in “my_list” contains a digit, it is removed from the front of the list
-
-
Responses