Mega Code Archive

 
Categories / Python Tutorial / List
 

Appending items to a list

playList = []     # list of favorite plays for i in range( 5 ):    playName = raw_input( "Play %d: " % ( i + 1 ) )    playList.append( playName )     print "\nSubscript     Value" for i in range( len( playList ) ):    print "%9d     %-25s" % ( i + 1, playList[ i ] )