Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Techniques

Similar presentations


Presentation on theme: "Programming Techniques"— Presentation transcript:

1 Programming Techniques
Keywords Arithmetic, Boolean, String, Concatenate (join), Substring, Delimiter, SPLIT, left, mid, right, Addition, Subtraction, Division, Modular division, Integer division, Negation, AND, OR, NOT, Greater than, Less than, Equal, Not equal, Modulus, Quotient, Exponentiation Programming Techniques Operators

2 Operators Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Once we have the information that we received from inputs or “hard-coded” (typed in when designing) in the program we need to manipulate this data – calculate, compare, etc. Operators represent the operations that are performed on the data. You already know operators in Maths, e.g. +, -, /, *, ^, etc. Starter activity

3 Questions Why do we need this? What is BODMAS?
Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. What is BODMAS? Why is it important to know it? What does the following calculation give? (10 * 4) / 5 – 10 /1 * 0 = ??? Find out what operators you can use in python. Add a sentence and example of each one in use Why do we need this? Without operators and correct order for calculations, we can get in a mess! We need strict rules to ensure results are as intended. Operators cover a wide range of activities in programming. Starter activity

4 Operators in Use Objectives + Addition e.g. x = 6 + 5 gives 11 -
BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Numbers: addition, subtraction, division, modular division (division with a remainder), integer division, multiplication, to-the-power-of, negation Boolean: AND, OR, NOT, larger, smaller, equal, not equal Strings/characters: slicing, length, format + Addition e.g. x = gives 11 - Subtraction e.g. x = gives 1 * Multiplication e.g. x = 12 * 2 gives 24 / Division e.g. x = 12 / 2 gives 6 MOD Modulus e.g. 12 MOD 5 gives 2 DIV Quotient e.g. 17 DIV 5 gives 3 ^ Exponentiation e.g. 3^4 gives 81 Starter activity

5 Operators in Use Logical operators – only used with Booleans
Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity Logical operators – only used with Booleans AND - OR - NOT

6 Operators in Use Objectives Starter activity
BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

7 MOD: Finding out Divisibility
Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. We often have to break items into groups. (a) how many full football teams can be made from 53 pupils (b) how many pupils will be without a team? Division could be used to solve (a) ”Integer division” is division which ignores the remainder DIV 11 = 4 (b) can be solved through “modulus division”. Modulus gives the remainder left by diving one number with another 53 MOD 11 = 9, in other words 9 pupils would be without a team. Starter activity

8 String Operations Objectives Starter activity
BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

9 String Operations (Pseudocode)
Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

10 String Operations (Examples)
Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

11 String Operations (Activity)
Objectives BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Given these two variables: string A ="Great to see you!" string B="Britain to get showers overnight.” Use string operators and pseudocode to get the following strings: 1. "GREAT BRITAIN" 2. "TO SEE GREAT BRITAIN" Starter activity

12 Boolean Operators Objectives Starter activity
BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

13 Boolean Example Objectives Starter activity
BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity

14 Answer Objectives Starter activity
BEGINNER: Identify different operators used in programming. ADVANCED: Use the most appropriate arithmetic, Boolean and string operators in different situations. EXPERT: Manipulate strings using different operators. Starter activity


Download ppt "Programming Techniques"

Similar presentations


Ads by Google