CSCA08H3 Lecture : Worksheet
46 views5 pages
Document Summary
It is like a list (elements that you can index and slice), but immutable. In fact, there are no tuple methods you can call. But, you can call function len and you can loop through a tuple. for item in t: print item def max_min(l): """return the maximum and the minimum value of list. L as a tuple, in that order. """ return max(l), min(l) # calling the function and naming the return values: Co2 emissions by year in north america (thousands of tons of carbon) The co2 list at position i represents the emission for the year at position i in the year list. What happens when we want to add a data point: 1950 both lists. Delete an item yikes (change both lists find corresponding elements) Better, but this can still be a bit awkward to look up a year. We must search the list to find it.
Get access
Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers