seven input and output there are several ways to present the output of programdata can be printed in human-readable formor written to file for future use this will discuss some of the possibilities fancier output formatting so far we've encountered two ways of writing valuesexpression statements and the print(function ( third way is using the write(method of file objectsthe standard output file can be referenced as sys stdout see the library reference for more information on this often you'll want more control over the formatting of your output than simply printing space-separated values there are several ways to format output to use formatted string literalsbegin string with or before the opening quotation mark or triple quotation mark inside this stringyou can write python expression between and characters that can refer to variables or literal values year event 'referendumf'results of the {year{event}'results of the referendumthe str format(method of strings requires more manual effort you'll still use and to mark where variable will be substituted and can provide detailed formatting directivesbut you'll also need to provide the information to be formatted yes_votes no_votes percentage yes_votes/(yes_votes+no_votes'{:- yes votes {: %}format(yes_votespercentage yes votes %finallyyou can do all the string handling yourself by using string slicing and concatenation operations to create any layout you can imagine the string type has some methods that perform useful operations for padding strings to given column width when you don' need fancy output but just want quick display of some variables for debugging purposesyou can convert any value to string with the repr(or str(functions the str(function is meant to return representations of values which are fairly human-readablewhile repr(is meant to generate representations which can be read by the interpreter (or will force syntaxerror if there is no equivalent syntaxfor objects which don' have particular representation for human consumptionstr(will return the same value as repr(many valuessuch as numbers or structures like lists and dictionarieshave the same representation using either function stringsin particularhave two distinct representations some examples