as expectedthis code outputsx container lookups we aren' restricted to passing simple string variables into the format method any primitivesuch as integers or floats can be printed more interestinglycomplex objectsincluding liststuplesdictionariesand arbitrary objects can be usedand we can access indexes and variables (but not methodson those objects from within the format string for exampleif our -mail message had grouped the from and to -mail addresses into tupleand placed the subject and message in dictionaryfor some reason (perhaps because that' the input required for an existing send_mail function we want to use)we can format it like thisemails (" @example com"" @example com"message 'subject'"you have mail!"'message'"here' some mail for you!template ""fromtosubject{message[subject]{message[message]}""print(template format(emailsmessage=message)the variables inside the braces in the template string look little weirdso let' look at what they're doing we have passed one argument as position-based parameter and one as keyword argument the two -mail addresses are looked up by [ ]where is either or the initial zero representsas with other position-based argumentsthe first positional argument passed to format (the emails tuplein this casethe square brackets with number inside are the same kind of index lookup we see in regular python codeso [ maps to emails[ ]in the emails tuple the indexing syntax works with any indexable objectso we see similar behavior when we access message[subject]except this time we are looking up string key in dictionary notice that unlike in python codewe do not need to put quotes around the string in the dictionary lookup