I would use a tuple of dictionaries.
import random
quotes = (
{'author':"Kahlil Gibran", 'quote':"A candle loses nothing of its light
when
lighting another."), #My favorite
{'author':"Henrik Ibsen", 'quote':"The strongest man in the world is he
who stands
most alone."})
quote = random.choic
On 31/08/11 20:14, Cranky Frankie wrote:
This code works. Now I just have to figure out:
- how to associate .py files in Ubuntu to IDLE
You probably don't want to do that. IDLE is fine for developing code but
you don't want to run it in IDLE for general use you want to use the
interpreter.
[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
On 31 August 2011 21:14, Cranky Frankie wrote:
> I made some headway on the quote of the day program. I just tried to
> do it simple using two assumptions:
>
> - long quotes are going to print funny until I figure out the string
> splitting stuff
Define funny? Normally the linux console will wrap
-Original Message-
I made some headway on the quote of the day program. I just tried to
do it simple using two assumptions:
- long quotes are going to print funny until I figure out the string
splitting stuff
- hard coding the quotes and authors in the program is simple, and I
can use a sp
I made some headway on the quote of the day program. I just tried to
do it simple using two assumptions:
- long quotes are going to print funny until I figure out the string
splitting stuff
- hard coding the quotes and authors in the program is simple, and I
can use a spreadsheet to generate the s