Random Famous Quote Generator

  • Share this:

Code introduction


This function randomly returns a famous quote.


Technology Stack : The Questionary library is not used, but the Python built-in random module is used to randomly select a quote.

Code Type : Function

Code Difficulty : Beginner


                
                    
import random

def random_quote():
    quotes = [
        "The only way to do great work is to love what you do. - Steve Jobs",
        "The future belongs to those who believe in the beauty of their dreams. - Eleanor Roosevelt",
        "Success is not final, failure is not fatal: It is the courage to continue that counts. - Winston Churchill",
        "The best way to predict the future is to create it. - Peter Drucker",
        "The secret of getting ahead is getting started. - Mark Twain"
    ]
    return random.choice(quotes)