import random
from datetime import datetime
class QuoteGenerator:
def __init__(self):
self.quotes = [
("The only way to do great work is to love what you do.", "Steve Jobs"),
("Believe you can and you're halfway there.", "Theodore Roosevelt"),
("Success is not final, failure is not fatal: it is the courage to continue that counts.", "Winston Churchill"),
("The future belongs to those who believe in the beauty of their dreams.", "Eleanor Roosevelt"),
("It does not matter how slowly you go as long as you do not stop.", "Confucius"),
("Everything you've ever wanted is on the other side of fear.", "George Addair"),
("Believe in yourself. You are braver than you think, more talented than you know, and capable of more than you imagine.", "Roy T. Bennett"),
("I learned that courage was not the absence of fear, but the triumph over it.", "Nelson Mandela"),
("The only impossible journey is the one you never begin.", "Tony Robbins"),
("Your limitation—it's only your imagination.", "Unknown"),
("Great things never come from comfort zones.", "Unknown"),
("Dream it. Wish it. Do it.", "Unknown"),
("Success doesn't just find you. You have to go out and get it.", "Unknown"),
("The harder you work for something, the greater you'll feel when you achieve it.", "Unknown"),
("Dream bigger. Do bigger.", "Unknown"),
("Don't stop when you're tired. Stop when you're done.", "Unknown"),
("Wake up with determination. Go to bed with satisfaction.", "Unknown"),
("Do something today that your future self will thank you for.", "Unknown"),
("Little things make big days.", "Unknown"),
("It's going to be hard, but hard does not mean impossible.", "Unknown"),
("Don't wait for opportunity. Create it.", "Unknown"),
("Sometimes we're tested not to show our weaknesses, but to discover our strengths.", "Unknown"),
("The key to success is to focus on goals, not obstacles.", "Unknown"),
("Dream it. Believe it. Build it.", "Unknown"),
("Act as if what you do makes a difference. It does.", "William James"),
("Success is not how high you have climbed, but how you make a positive difference to the world.", "Roy T. Bennett"),
("What lies behind us and what lies before us are tiny matters compared to what lies within us.", "Ralph Waldo Emerson"),
("You are never too old to set another goal or to dream a new dream.", "C.S. Lewis"),
("The only person you are destined to become is the person you decide to be.", "Ralph Waldo Emerson"),
("Start where you are. Use what you have. Do what you can.", "Arthur Ashe")
]
def get_quote_of_the_day(self):
"""Generate a consistent quote for today based on the date"""
today = datetime.now().date()
seed = int(today.strftime("%Y%m%d"))
random.seed(seed)
quote, author = random.choice(self.quotes)
return quote, author
def get_random_quote(self):
"""Get a completely random quote"""
quote, author = random.choice(self.quotes)
return quote, author
def display_quote(self, quote, author):
"""Display quote in a formatted way"""
border = "=" * 60
print(border)
print(f"\n 📜 Quote of the Day - {datetime.now().strftime('%B %d, %Y')}\n")
print(f' "{quote}"')
print(f"\n — {author}\n")
print(border)
def save_quote_to_file(self, quote, author, filename="daily_quote.txt"):
"""Save today's quote to a file"""
with open(filename, "w") as f:
f.write(f"Quote of the Day - {datetime.now().strftime('%B %d, %Y')}\n")
f.write(f"\n\"{quote}\"\n")
f.write(f"\n— {author}\n")
print(f"\nQuote saved to {filename}")
def main():
generator = QuoteGenerator()
print("\n🌟 Daily Inspirational Quote Generator 🌟\n")
print("1. Show today's quote")
print("2. Get random quote")
print("3. Save today's quote to file")
print("4. Exit")
while True:
choice = input("\nEnter your choice (1-4): ").strip()
if choice == "1":
quote, author = generator.get_quote_of_the_day()
generator.display_quote(quote, author)
elif choice == "2":
quote, author = generator.get_random_quote()
generator.display_quote(quote, author)
elif choice == "3":
quote, author = generator.get_quote_of_the_day()
generator.save_quote_to_file(quote, author)
elif choice == "4":
print("\nStay inspired! 💪\n")
break
else:
print("Invalid choice. Please enter 1-4.")
if __name__ == "__main__":
main()