Download presentation
Presentation is loading. Please wait.
Published byJanice Dawson Modified over 6 years ago
1
Computer Science G10 T3- 2018\2017 T shaikhah AlZeyoudi
Dibba Al Fujairah
2
Week2 Unit5 – Lesson2 P. #19-26 Term3 -- Python
Unit 5 - Data structures Week2 Unit5 – Lesson2 P. #19-26 15 Apr 2018
3
Explain the use of loops with lists.
loop, list Explain the use of loops with lists. Demonstrate and let the students experiment with using for and while loops in conjunction with lists. Show and explain how to create lists dynamically.
4
Review last lesson Lists
5
Explain the use of loops with lists
7
for i in range (0,3,1): print(i)
8
Reading and writing data in lists
9
Counter x Square 1 2 4 3 9 16 5 25 6 36 7 49 8 64
11
set values Using a loop to
12
user inputs Using a loop to
13
Using a loop to printing
14
Creating Empty List
15
You may not have the data or know the size of your list before your program starts. You can create an empty list first, and then add elements and values later NAME = []
16
append( ) function
17
NAME.append(“stud1”) NAME.append(“stud2”)
18
append( ) function to add value List
19
student_Grades=[] finish="no" while finish=="no": grade=input("Enter the Grade :") grade=int(grade) student_Grades.append(grade) finish=input("Are you Finished ? ") print(student_Grades)
20
Activity
21
Activity 2: Using loops to set and read values in a list
22
Open: 10-Term3 2-Select you class folder 10A-….. 10G-…..
23
1 2 4 3
24
Week2-NAME Now Open new python name as: Applied the Task sheet
If you finish: Save your answer Run the output Ask the teacher to correct Week2-NAME
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.