4.4
Lists: create, access and modify (4.4) is a Class 10 Computer Science lesson for the Punjab boards. It walks through the idea in plain steps, then sets a short check, in English, Urdu or Roman Urdu.
Your guide: Miss HiraExplains computers with chai, cricket and your phone.
Chapter 1 of every subject is free. Unlock every chapter of this class with the full course.
Unlock full courseAlready paid? Sign in with the Google account you paid with.
A list holds items in square brackets, separated by commas: fruits = ["Mango", "Apple", "Banana"]. Items can be of different types.
Indexes start at 0: fruits[0] is Mango, fruits[1] is Apple and fruits[2] is the third item. Change an item by assigning: fruits[0] = "Orange".
Methods: append(item) adds at the end; remove(item) deletes the first match only; sort() arranges in ascending order; reverse() flips the order.
Step 1 / 1
A list holds items in square brackets, separated by commas: fruits = ["Mango", "Apple", "Banana"]. Items can be of different types.
Indexes start at 0: fruits[0] is Mango, fruits[1] is Apple and fruits[2] is the third item. Change an item by assigning: fruits[0] = "Orange".
Methods: append(item) adds at the end; remove(item) deletes the first match only; sort() arranges in ascending order; reverse() flips the order.
Index from 0; append adds, remove deletes the first match, sort orders, reverse flips.
Found a mistake? Tell us the lesson and the line at exciting@boringeducation.com.
No ads. Tell us what to fix.