Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMPUTING.

Similar presentations


Presentation on theme: "COMPUTING."— Presentation transcript:

1 COMPUTING

2 2.2 Programming Techniques
Python Code: variable/constant=input(“string”) print(variable/constant + “string”) if variable/constant (comparison e.g. ==) value: elif variable/constant <= value: else: for i in range (0,5): while variable == condition: Declaration: Identifying a variable or constant so that a suitable memory location can be assigned to it. Constant: data value is set when declared Variable: data value is set while program is running Data Types: real numbers (10.1) integer (10) string (hello!1) char (a) boolean (TRUE) Casting: changing a variable from one data type to another Programming Constructs: Sequence – an algorithm putting instructions in order (INPUT, OUTPUT and calculation) Selection – an algorithm with a decision or choice (IF, ELSE, END IF) Iteration – an algorithm with a loop (FOR, END FOR, REPEAT, END REPEAT, WHILE, END WHILE)

3 2.2 Programming Techniques
Functions: add (+) subtract (-) multiply (*) divide (/) to the power of (**) e.g. 42 = 4**2 DIV or // (Quotient): division giving the answer as an integer, ignoring the remainder e.g. 14/3 = 4 rem 2 MOD or % (Modulus): finds the remainder, of a division e.g. 14/3=4 rem 2 Assignment: one = sets the value of a constant/variable (e.g. total = 10 – makes the variable total be equal to the value 10) Comparison: equal to == not equal to <> or != less than < and less than or equal to <= greater than > and greater than or equal to >= Boolean operators: AND (e.g. 3<5 AND 2>1), OR (e.g. 1>8 OR 2==2), NOT(10>6) – these will return a TRUE or FALSE result String manipulation: string.len = returns the length, string+string = concatenates two strings, string.upper/string.lower = upper and lowercase


Download ppt "COMPUTING."

Similar presentations


Ads by Google