collection data types total for sale in salestotal +sale quantity sale price print("total ${ }format(total)printstotal $ the clarity and convenience that named tuples provide are often useful for examplehere is the "aircraftexample from the previous subsection ( done the nice wayaircraft collections namedtuple("aircraft""manufacturer model seating"seating collections namedtuple("seating""minimum maximum"aircraft aircraft("airbus"" - "seating( )aircraft seating maximum when it comes to extracting named tuple items for use in strings there are three main approaches we can take print("{ { }format(aircraft manufactureraircraft model)airbus - here we have accessed each of the tuple' items that we are interested in using named tuple attribute access this gives us the shortest and simplest format string (and in python we could reduce this format string to just "{{}but this approach means that we must look at the arguments passed to str format(to see what the replacement texts will be this seems less clear than using named fields in the format string "{ manufacturer{ model}format(aircrafthere we have used single positional argument and used named tuple attribute names as field names in the format string this is much clearer than just using positional arguments alonebut it is pity that we must specify the positional value (even when using python fortunatelythere is nicer way named tuples have few private methods--that ismethods whose name begins with leading underscore one of them--namedtuple _asdict()--is so useful that we will show it in action "{manufacturer{model}format(**aircraft _asdict()using str format(with mapping unpacking the private namedtuple _asdict(method returns mapping of key-value pairswhere each key is the name of tuple element and each value is the cor private methods such as namedtuple _asdict(are not guaranteed to be available in all python versionsalthough the namedtuple _asdict(method is available in both python and