Presentation is loading. Please wait.

Presentation is loading. Please wait.

PYTHON PROGRAMMING Week 8 - Wednesday. WHAT DO THESE DO? for x in range(5): print x for x in range(1,5): print x for x in range(1,5): print x**2 numbers.

Similar presentations


Presentation on theme: "PYTHON PROGRAMMING Week 8 - Wednesday. WHAT DO THESE DO? for x in range(5): print x for x in range(1,5): print x for x in range(1,5): print x**2 numbers."— Presentation transcript:

1 PYTHON PROGRAMMING Week 8 - Wednesday

2 WHAT DO THESE DO? for x in range(5): print x for x in range(1,5): print x for x in range(1,5): print x**2 numbers = [1, 2, 3, 2, 5, 4, 2] for x in range(len(numbers)): print numbers[x] list = [1, 2, 3, 2, 5, 4, 2] for number in numbers: print number

3 LAST WEEK Design  Structure Charts – Selection & Iteration Python  Lists

4 TODAY Design  Structure charts – linear search Python  Linear search  Lists

5 STRUCTURE CHARTS - LOOPS Work out finalBill 1 finalBill =TotalfinalBill = £10 falsetrue Key 1. total < 10

6 STRUCTURE CHARTS - ITERATION Print Numbers 1 to 10 print x For x = 1 to 10

7 STRUCTURE CHARTS – EXERCISE (PAIRED WORK) You need to find the position of a name in a list. For example, given this list: [“Sam”, “Malik”, “Chandni”, “Manzal”, “Joseph”, “Cris”] and asked to search for “Manzal” you would display “Position 3”. So your solution needs to ask for a name, find it in the list and display its position or ‘”Not found’ Pairs: Cris & Jacob, Manzal & Sam, Sean & Joe, Elvis & Bradley, Chandni & Malik

8 SOLUTION?

9 PYTHON Write a program for your design

10 RECAP How do you represent a sequence using a structure chart? How do you represent a selection using a structure chart? How do you represent an iteration using a structure chart?

11 TOMORROW More exercises to consolidate your learning so far – designs and programs Go through ‘Terms and Concepts’ sheets (1 and 2)


Download ppt "PYTHON PROGRAMMING Week 8 - Wednesday. WHAT DO THESE DO? for x in range(5): print x for x in range(1,5): print x for x in range(1,5): print x**2 numbers."

Similar presentations


Ads by Google