I&C SCI 32 Lecture Notes - Lecture 8: Init, Software Engineering

43 views5 pages

Document Summary

You"ve seen previously how to use namedtuples, which is one way in python to collect heterogeneous data into a single object. Each piece of data is called a fieldand the fields are identified by their names. Beyond that, namedtuples don"t really know how to do much of anything; they"re useful, but limited to the problem of bringing a few pieces of data together into the same object. For example, consider this interaction with a python interpreter. >>> s = "this is a string object" After creating a string and storing it in the variable s, we then ask that string to do a couple of things for us: Hey, s, split yourself into a list of words, by using spaces to delineate where one word ends and another begins, and give me back the resulting list. The syntax s. upper() is called a method call on the object s; in this case, upper() is called a method.

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

Related Questions