CP104 Lecture 5: 7. Lists

79 views3 pages
School
Course
Professor
Topic-7
Sequence: stored in memory in multiple locations
1st item in location 0
We don't have to keep track of seperate 14 variables
E.g whale = [5,4,7]
To access count=whales[0]+whales[1]+.....+ whales [13]
5 is in location 0
Need to be able to create a list
assgn_grades= [80,90,100,75,80]
List (range(0,5))
[0,1,2,3,4]
list(5) ‘int’ object is not (error)
pay_list= [0]*5
empty_lis=[]
#Ths works too
empty_List= list() have to create empty list and then add stuff to it
friends=[‘MATT]’,’asmaa’]
print(friend(1))---->asmaa
For index in range(3):
len() takes ant interval and returns how many items are inside
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in
hayjayshay and 38575 others unlocked
CP104 Full Course Notes
2
CP104 Full Course Notes
Verified Note
2 documents

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents