[Tutor] Quote of the Day version 1.0

Prasad, Ramit ramit.prasad at jpmorgan.com
Thu Sep 1 00:41:04 CEST 2011


[snip]

> Do not hesitate to ask questions as I added tuple unpacking and string
>formatting which you might not have covered in depth yet in your
>tutorial.

[snip]

>author, quote = random.choice(quotes)
>print "%s\n\tBy %s" % (quote, author)

I figured I might as well add my preferred method of string formatting. :)
print 'The quote "{0}" is by {1}. I {2} {1}'.format(quote, author, 'love') # although you might hate {1} ;)

Ramit

P.S. Notice the mixed quote convention.


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423



This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list