πŸ“– Beginning Python Programming /
Module: List & Collection

Code Example: Random Quote

πŸ“– Beginning Python Programming / List & Collection / Code Example: Random Quote

Quotes Example v4

from random import choice

quotes = (
    {"quote":"I want to put a ding in the universe.", "source":"Steve Jobs"},
    {"quote":"Life is 10% what happens to you and 90% how you react to it.", "source":"Charles R. Swindoll"},
    {"quote":"Family is not an important thing. It's everything.", "source":"Michael J. Fox"},
    {"quote":"Nothing is impossible, the word itself says 'I'm possible'!", "source":"Audrey Hepburn"},
    {"quote":"There are two ways of spreading light: to be the candle or the mirror that reflects it.", "source":"Edith Wharton"},
    {"quote":"Try to be a rainbow in someone's cloud.", "source":"Maya Angelou"},
    {"quote":"Be brave enough to live life creatively. The creative place where no one else has ever been.", "source":"Alan Alda"},
    {"quote":"The secret of getting ahead is getting started.", "source":"Mark Twain"},
)

quote = choice(quotes)
content = quote["quote"]
source = quote["source"]

print(f'β€œ{content}” β€” {source}')